DialogFragment behaves differently when invoked via ActionBar
Asked Answered
D

1

1

I'm experiencing strange, perhaps version-specific behavior with my DialogFragment subclass when testing the following steps:

(1) Open the dialog
(2) Leave the app with either the Home key or the Recent Apps key
(3) Return to the app, and the dialog is no longer visible. It seems to be briefly, translucently visible behind the main activity.
(4) Rotate the device, and the dialog re-appears.

This bug occurs on my Asus TF700T pad running Android 4.2.1, and it does not occur on my Motorola Razr phone running Android 4.1.2 (which has a menu key rather than an overflow button). Moreover, it only occurs if the dialog is opened via the overflow menu - dialogs opened via ActionBar items do not exhibit this issue! And finally, the issue does not occur if you do an orientation change before pausing the activity.

I have found a very similar issue which includes depressing comments like "This is clearly an Android bug." There are associated bug reports. Please, say it ain't so...

My workaround for this issue is in onResume(): I check the FragmentManager for existing dialogs with findFragmentByTag; if any are not null I dismiss and re-show them. But I'd like to understand what's really going on here.

Danaedanaher answered 10/9, 2013 at 23:6 Comment(0)
D
0

I guess the answer to this question is the Google bug report linked above. I changed my design to avoid the problem, so I have not tried the workaround someone there has posted.

Danaedanaher answered 15/9, 2013 at 5:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.