我使用ProgressDialog时出错。下面是logcat:
E/WindowManager: android.view.WindowLeaked: Activity com.example.data.CariBuku has leaked window com.android.internal.policy.PhoneWindow$DecorView{137ca20 V.E...... R......D 0,0-1026,348} that was originally added here
at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368)
at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299)
at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85)
at android.app.Dialog.show(Dialog.java:319)
at com.example.data.CariBuku$Cari.onPreExecute(CariBuku.java:126)
at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:604)
at android.os.AsyncTask.execute(AsyncTask.java:551)
at com.example.data.CariBuku$1.onClick(CariBuku.java:77)
at android.view.View.performClick(View.java:5198)
at android.view.View.onKeyUp(View.java:9879)
at android.widget.TextView.onKeyUp(TextView.java:6248)
at android.view.KeyEvent.dispatch(KeyEvent.java:2664)
at android.view.View.dispatchKeyEvent(View.java:9234)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at android.view.ViewGroup.dispatchKeyEvent(ViewGroup.java:1640)
at com.android.internal.policy.PhoneWindow$DecorView.superDispatchKeyEvent(PhoneWindow.java:2395)
at com.android.internal.policy.PhoneWindow.superDispatchKeyEvent(PhoneWindow.java:1727)
at android.app.Activity.dispatchKeyEvent(Activity.java:2725)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:534)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:50)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:241)
at com.android.internal.policy.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2310)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:4127)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4089)
我已经在onPostExecute方法中关闭了该对话框,但仍然出现此错误...请帮助...谢谢:D
答案 0 :(得分:0)
当您的活动完成但对话框仍然显示时,会出现窗口泄漏错误。
您可以通过多种方式处理此错误:
if(!HomePage.this.isFinishing())
- 解雇后你完成了活动吗?