summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Dianne Hackborn <hackbod@google.com> 2010-10-06 17:26:16 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-10-06 17:26:16 -0700
commit9d6824cd53960b4562ea3c55876b40ca21710050 (patch)
tree71eecd2167af53d4680ee2af84fc213951accc56
parent5919ac6b4188285324646772501ef4b97b353cf4 (diff)
parentd2ce8bbb84607b1f456b9af00d8d7b84a4610a79 (diff)
Merge "Make Activity.removeDialog() less strict." into gingerbread
-rw-r--r--core/java/android/app/Activity.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 2c4babb37a79..78a77eb09997 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -2609,6 +2609,10 @@ public class Activity extends ContextThemeWrapper
* <p>This can be useful if you know that you will never show a dialog again and
* want to avoid the overhead of saving and restoring it in the future.
*
+ * <p>As of {@link android.os.Build.VERSION_CODES#GINGERBREAD}, this function
+ * will not throw an exception if you try to remove an ID that does not
+ * currently have an associated dialog.</p>
+ *
* @param id The id of the managed dialog.
*
* @see #onCreateDialog(int, Bundle)
@@ -2617,17 +2621,13 @@ public class Activity extends ContextThemeWrapper
* @see #dismissDialog(int)
*/
public final void removeDialog(int id) {
- if (mManagedDialogs == null) {
- return;
- }
-
- final ManagedDialog md = mManagedDialogs.get(id);
- if (md == null) {
- return;
+ if (mManagedDialogs != null) {
+ final ManagedDialog md = mManagedDialogs.get(id);
+ if (md != null) {
+ md.mDialog.dismiss();
+ mManagedDialogs.remove(id);
+ }
}
-
- md.mDialog.dismiss();
- mManagedDialogs.remove(id);
}
/**