用ProgressDialog的地方,最好加下這個屬性,防止4.0系統出問題。mProgressDialog.setCanceledOnTouchOutside(false);
就是在loading的時候,若是你觸摸屏幕其它區域,就會讓這個progressDialog消失,而後可能出現崩潰問題,以下:
09-28 11:21:09.476: E/AndroidRuntime(20934): FATAL EXCEPTION: main
09-28 11:21:09.476: E/AndroidRuntime(20934): java.lang.IllegalArgumentException: View not attached to window manager
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:653)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:349)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:160)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.app.Dialog.dismissDialog(Dialog.java:319)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.app.Dialog.dismiss(Dialog.java:302)
09-28 11:21:09.476: E/AndroidRuntime(20934): at com.renren.mobile.flok.ui.login.ai.run(Unknown Source)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.os.Handler.handleCallback(Handler.java:615)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.os.Handler.dispatchMessage(Handler.java:92)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.os.Looper.loop(Looper.java:137)
09-28 11:21:09.476: E/AndroidRuntime(20934): at android.app.ActivityThread.main(ActivityThread.java:4899)
09-28 11:21:09.476: E/AndroidRuntime(20934): at java.lang.reflect.Method.invokeNative(Native Method)
09-28 11:21:09.476: E/AndroidRuntime(20934): at java.lang.reflect.Method.invoke(Method.java:511)
09-28 11:21:09.476: E/AndroidRuntime(20934): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
09-28 11:21:09.476: E/AndroidRuntime(20934): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:558)
09-28 11:21:09.476: E/AndroidRuntime(20934): at dalvik.system.NativeStart.main(Native Method)
一個崩潰問題(4.0以上dialog問題)
轉自:
http://blog.csdn.net/shichaosong/article/details/8028020