Android日常异常处理(1)

堆栈:

01-13 10:32:27.837    4980-4980/com.xxx:error E/WindowManager﹕ Activity com.xxx.ErrorActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{2216cbb8 V.E..... R.....ID 0,0-442,345} that was originally added here

    android.view.WindowLeaked: Activity com.xxx.ErrorActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{2216cbb8 V.E..... R.....ID 0,0-442,345} that was originally added here

            at android.view.ViewRootImpl.<init>(ViewRootImpl.java:356)

            at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:239)

            at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)

            at android.app.Dialog.show(Dialog.java:281)

            at android.app.ProgressDialog.show(ProgressDialog.java:116)

            at android.app.ProgressDialog.show(ProgressDialog.java:99)

            at android.app.ProgressDialog.show(ProgressDialog.java:94)

            at com.xxx.ErrorActivity.onSubmitError(ErrorActivity.java:328)

            at com.xxx.ErrorActivity.errorOpt(ErrorActivity.java:288)

            at com.xxx.ErrorActivity.myOnClick(ErrorActivity.java:253)

            at com.xxx.ErrorActivity.access$100(ErrorActivity.java:51)

            at com.xxx.ErrorActivity$6.onClick(ErrorActivity.java:220)

            at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:167)

            at android.os.Handler.dispatchMessage(Handler.java:99)

            at android.os.Looper.loop(Looper.java:150)

            at android.app.ActivityThread.main(ActivityThread.java:5200)

            at java.lang.reflect.Method.invokeNative(Native Method)

            at java.lang.reflect.Method.invoke(Method.java:525)

            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)

            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

            at dalvik.system.NativeStart.main(Native Method)

原因:在Dialog dismiss之前finish掉了Activity

修复:先dismiss掉Dialog,然后再finish掉Activity





你可能感兴趣的:(Android日常异常处理(1))