2017-06-21 46 views
0

當完成了顯示對話框中的活動,警告將顯示爲波紋管,做這個結果內存泄漏,或者只是警告是否機器人windowLeak導致內存泄漏?

 WindowManager: android.view.WindowLeaked: Activity MainActivity 
     has leaked window com.android.internal.policy.PhoneWindow$DecorView{a310978 V.ED..... R......D 0,0-1080,1704} 
     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.snail.labaffinity.activity.FullScrreenDialog.show(FullScrreenDialog.java:81) 
    at com.snail.labaffinity.activity.MainActivity.alertdialog(MainActivity.java:71) 
    at com.snail.labaffinity.activity.MainActivity$$ViewBinder$4.doClick(MainActivity$$ViewBinder.java:47) 
    at butterknife.internal.DebouncingOnClickListener.onClick(DebouncingOnClickListener.java:22) 
    at android.view.View.performClick(View.java:5204) 
    at android.view.View$PerformClick.run(View.java:21153) 
    at android.os.Handler.handleCallback(Handler.java:739) 
    at android.os.Handler.dispatchMessage(Handler.java:95) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5417) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

回答

0

它是內存泄漏有時往往會導致應用程序崩潰。 如果您的活動已被破壞,則會發生此錯誤。當您使用對話框時會發生此錯誤..!所以處理完你的對話。

@覆蓋

public void onDestroy() { 
super.onDestroy(); 
if (dialog != null) { 
    dialog.dismiss(); 
    dialog = null; 
} 

} 作爲我的參考Android : Window Manager : android view window leaked

+0

謝謝,我知道這一點。不過,我不知道是否windowleak導致內存泄漏 – happysnail

0

這個錯誤是因爲你不解僱你已經創建了對話框,你直接關閉你的活動。

這個錯誤看起來很小,但有時會導致崩潰。

因此,在完成活動之前,請按照建議@hemanth reddy

+0

windowLeak是否導致內存泄漏? – happysnail

+0

不,它不會導致內存泄漏 – 2017-06-22 07:18:01