TIL: DialogFragment and Dismiss behavior-While Inflated.
If you call dismiss() on dialog fragment while it's inflated in view. It just simply calls popBackstack().
This issue was encountered because previously we had this fragment shown as dialog, and we just called dismiss() once the work is finished. As a part of additional functionality, we have to inflate this in existing fragment, and have to keep this dialog alive after the work is finished. But because of dismiss() the "inflated dialog" goes invisible.
Workaround, if you don't want to dismiss inflated dialogfragment. Check getDialog() is null or not. It will return null when it's inflated in view. Will return an object when shown as dialog
Posted Feb 22, 2016, 4:13 AM UTC
40