apache/incubator-cordova-android — pull request #1 by obrand (2012-01-25 07:15:14+00:00)
Title: Added catch/throw around dialog dismiss

I have noticed that when going back the stack in the browser, often it causes a crash due to the dialog being dismissed. This seems to be a well known issue in Android. For now I have added a try/catch with no-op around the dismiss.

The typical exception is:

java.lang.IllegalArgumentException: View not attached to window manager
at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:486)
at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:306)
at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:129)
at android.app.Dialog.dismissDialog(Dialog.java:306)
at android.app.Dialog.access$000(Dialog.java:73)
at android.app.Dialog$1.run(Dialog.java:110)
at android.app.Dialog.dismiss(Dialog.java:296)
at com.phonegap.DroidGap.spinnerStop(DroidGap.java:1067)
at com.phonegap.DroidGap$GapViewClient$1$1.run(DroidGap.java:1528)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:132)
at android.app.ActivityThread.main(ActivityThread.java:4126)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:491)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
at dalvik.system.NativeStart.main(Native Method)