diff options
Diffstat (limited to 'core/java/android/app/DialogFragment.java')
-rw-r--r-- | core/java/android/app/DialogFragment.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/core/java/android/app/DialogFragment.java b/core/java/android/app/DialogFragment.java index 8e2389b..cbecc21 100644 --- a/core/java/android/app/DialogFragment.java +++ b/core/java/android/app/DialogFragment.java @@ -256,6 +256,10 @@ public class DialogFragment extends Fragment * the fragment. */ public void dismiss() { + dismissInternal(false); + } + + void dismissInternal(boolean allowStateLoss) { if (mDialog != null) { mDialog.dismiss(); mDialog = null; @@ -271,7 +275,7 @@ public class DialogFragment extends Fragment ft.commit(); } } - + public Dialog getDialog() { return mDialog; } @@ -353,7 +357,11 @@ public class DialogFragment extends Fragment public void onDismiss(DialogInterface dialog) { if (!mRemoved) { - dismiss(); + // Note: we need to use allowStateLoss, because the dialog + // dispatches this asynchronously so we can receive the call + // after the activity is paused. Worst case, when the user comes + // back to the activity they see the dialog again. + dismissInternal(true); } } |