summaryrefslogtreecommitdiffstats
path: root/core/java/android
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2009-07-08 10:54:45 -0700
committerRomain Guy <romainguy@android.com>2009-07-08 13:56:28 -0700
commit6de4aed1c67263269f83f579ec5b06263d173ef3 (patch)
treeccb10ac929f2aa6adda69735885c7ef2d4c77547 /core/java/android
parent1bd3e0fb7e87f1daa983d06bc396393a788181b0 (diff)
downloadframeworks_base-6de4aed1c67263269f83f579ec5b06263d173ef3.zip
frameworks_base-6de4aed1c67263269f83f579ec5b06263d173ef3.tar.gz
frameworks_base-6de4aed1c67263269f83f579ec5b06263d173ef3.tar.bz2
Fixes #1933428. Call onPrepareDialog() on managed dialogs after their onCreate() is finished.
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/app/Activity.java8
-rw-r--r--core/java/android/app/Dialog.java6
2 files changed, 8 insertions, 6 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index df50f77..6c2560d 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -857,7 +857,7 @@ public class Activity extends ContextThemeWrapper
if (dialogState != null) {
// Calling onRestoreInstanceState() below will invoke dispatchOnCreate
// so tell createDialog() not to do it, otherwise we get an exception
- final Dialog dialog = createDialog(dialogId, false);
+ final Dialog dialog = createDialog(dialogId, dialogState);
mManagedDialogs.put(dialogId, dialog);
onPrepareDialog(dialogId, dialog);
dialog.onRestoreInstanceState(dialogState);
@@ -865,13 +865,13 @@ public class Activity extends ContextThemeWrapper
}
}
- private Dialog createDialog(Integer dialogId, boolean dispatchOnCreate) {
+ private Dialog createDialog(Integer dialogId, Bundle state) {
final Dialog dialog = onCreateDialog(dialogId);
if (dialog == null) {
throw new IllegalArgumentException("Activity#onCreateDialog did "
+ "not create a dialog for id " + dialogId);
}
- if (dispatchOnCreate) dialog.dispatchOnCreate(null);
+ dialog.dispatchOnCreate(state);
return dialog;
}
@@ -2407,7 +2407,7 @@ public class Activity extends ContextThemeWrapper
}
Dialog dialog = mManagedDialogs.get(id);
if (dialog == null) {
- dialog = createDialog(id, true);
+ dialog = createDialog(id, null);
mManagedDialogs.put(id, dialog);
}
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 222fe75..2b165fc 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -292,8 +292,10 @@ public class Dialog implements DialogInterface, Window.Callback,
// internal method to make sure mcreated is set properly without requiring
// users to call through to super in onCreate
void dispatchOnCreate(Bundle savedInstanceState) {
- onCreate(savedInstanceState);
- mCreated = true;
+ if (!mCreated) {
+ onCreate(savedInstanceState);
+ mCreated = true;
+ }
}
/**