diff options
author | Romain Guy <romainguy@android.com> | 2009-06-17 16:52:22 -0700 |
---|---|---|
committer | Romain Guy <romainguy@android.com> | 2009-06-17 17:04:09 -0700 |
commit | 764d5331d15c19162c938e617777b4bf15a6314d (patch) | |
tree | 64b68ceef1270e7aeca468842f697c061721aeb9 /core/java/android/app/Activity.java | |
parent | de72697b771d33738c5f9d6c28087504e0796622 (diff) | |
download | frameworks_base-764d5331d15c19162c938e617777b4bf15a6314d.zip frameworks_base-764d5331d15c19162c938e617777b4bf15a6314d.tar.gz frameworks_base-764d5331d15c19162c938e617777b4bf15a6314d.tar.bz2 |
Fixes #1924909. When restoring managed dialogs, do exactly the same thing as when showing a dialog.
Diffstat (limited to 'core/java/android/app/Activity.java')
-rw-r--r-- | core/java/android/app/Activity.java | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 501be01..51a8ed2 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -864,13 +864,24 @@ public class Activity extends ContextThemeWrapper final Integer dialogId = ids[i]; Bundle dialogState = b.getBundle(savedDialogKeyFor(dialogId)); if (dialogState != null) { - final Dialog dialog = onCreateDialog(dialogId); - dialog.onRestoreInstanceState(dialogState); + final Dialog dialog = createDialog(dialogId); mManagedDialogs.put(dialogId, dialog); + onPrepareDialog(dialogId, dialog); + dialog.onRestoreInstanceState(dialogState); } } } + private Dialog createDialog(Integer dialogId) { + final Dialog dialog = onCreateDialog(dialogId); + if (dialog == null) { + throw new IllegalArgumentException("Activity#onCreateDialog did " + + "not create a dialog for id " + dialogId); + } + dialog.dispatchOnCreate(null); + return dialog; + } + private String savedDialogKeyFor(int key) { return SAVED_DIALOG_KEY_PREFIX + key; } @@ -2419,12 +2430,7 @@ public class Activity extends ContextThemeWrapper } Dialog dialog = mManagedDialogs.get(id); if (dialog == null) { - dialog = onCreateDialog(id); - if (dialog == null) { - throw new IllegalArgumentException("Activity#onCreateDialog did " - + "not create a dialog for id " + id); - } - dialog.dispatchOnCreate(null); + dialog = createDialog(id); mManagedDialogs.put(id, dialog); } |