question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dialog not showing up.

See original GitHub issue

Summary:

Dialogs are not showing up(sometimes) in the HomePage, because the parser says that the current dialog view already has a parent and adding it to another parent would require us to remove this dialog view from the existing parent.

System logs:

java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
        at android.view.ViewGroup.addViewInner(ViewGroup.java:5034)
        at android.view.ViewGroup.addView(ViewGroup.java:4865)
        at android.view.ViewGroup.addView(ViewGroup.java:4837)
        at com.android.internal.app.AlertController.setupCustomContent(AlertController.java:627)
        at com.android.internal.app.AlertController.setupView(AlertController.java:521)
        at com.android.internal.app.AlertController.installContent(AlertController.java:264)
        at android.app.AlertDialog.onCreate(AlertDialog.java:436)
        at android.app.Dialog.dispatchOnCreate(Dialog.java:407)
        at android.app.Dialog.show(Dialog.java:302)
        at fr.free.nrw.commons.utils.DialogUtil.showSafely(DialogUtil.java:33)
        at fr.free.nrw.commons.utils.DialogUtil.showAlertDialog(DialogUtil.java:140)
        at fr.free.nrw.commons.utils.DialogUtil.showAlertDialog(DialogUtil.java:96)
        at fr.free.nrw.commons.contributions.ContributionsFragment.showNearbyCardPermissionRationale(ContributionsFragment.java:523)
        at fr.free.nrw.commons.contributions.ContributionsFragment.checkPermissionsAndShowNearbyCardView(ContributionsFragment.java:504)
        at fr.free.nrw.commons.contributions.ContributionsFragment.onResume(ContributionsFragment.java:484)
        at androidx.fragment.app.Fragment.performResume(Fragment.java:2499)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:926)
        at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1229)
        at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1295)
        at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2605)
        at androidx.fragment.app.FragmentManagerImpl.dispatchResume(FragmentManagerImpl.java:2577)
        at androidx.fragment.app.FragmentController.dispatchResume(FragmentController.java:267)
        at androidx.fragment.app.FragmentActivity.onResumeFragments(FragmentActivity.java:463)
        at androidx.fragment.app.FragmentActivity.onPostResume(FragmentActivity.java:453)
        at androidx.appcompat.app.AppCompatActivity.onPostResume(AppCompatActivity.java:173)
        at android.app.Activity.performResume(Activity.java:7325)
        at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3814)
        at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3854)
        at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
        at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:193)
        at android.app.ActivityThread.main(ActivityThread.java:6718)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
2019-06-23 10:36:28.746 10262-10262/fr.free.nrw.commons.beta E/ContributionsFragment: onFragmentResumed fr.free.nrw.commons.contributions.ContributionsListFragment

**Device and Android version:** 

Google Pixel, Api 27
 
**Commons app version:** 

2.10.2-debug

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
albendzcommented, Jul 16, 2019

I’m going to take a look at this and see what I can find or fix

1reaction
ashishkumar468commented, Jul 23, 2019

Dismiss alert dialogs on suspend because it is being recreated on resume Figure out if a dialog has already been created and don’t create another on resume

These two will require considerable changes, the DialogUtils is used from many places. The third option would solve the issue for now and IMO we can create another issue to refactor the DialogUtils to make sure multiple instances are not created.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dialog does not appear - Stack Overflow
You have to call show() method instead of create() . Note: create() method only creates instance of Dialog but it won't show its....
Read more >
Finding A Missing Dialog Box | Ideate Inc
After accessing the tool/command to open a dialog box/window, press [Alt]+[Spacebar], then press M, then press any arrow key on your keyboard.
Read more >
Windows 10 Dialog box not displaying correctly
Hi, I believe I have a slight problem with Windows 10 dialog boxes not displaying correctly. The information if displayed is bunched up...
Read more >
Dialog box windows are not displayed in AutoCAD products
Solution: · Execute the command to activate the dialog window. · Press ALT + SPACEBAR on the keyboard. · Press the M key...
Read more >
A dialog box does not appear to be opening?
Sometimes a dialog box may appear to not open on your screen. This can sometimes be caused by the dialog box opening off...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found