android.view.WindowLeaked

01-11 10:36:21.212 23092-23092/com.letv.motor E/WindowManager: android.view.WindowLeaked: Activity com.example.MainActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{1382176 V.E...... R.....I. 0,0-1120,433} that was originally added here
                                                                   at android.view.ViewRootImpl.(ViewRootImpl.java:435)
                                                                   at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:302)
                                                                   at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:86)
                                                                   at android.app.Dialog.show(Dialog.java:319)
                                                                   

报错原因:dialog被调用了两次

解决办法:show之前,检查是不是有处于show状态的dialog,有的话先dismiss()

 

参考:http://stackoverflow.com/questions/12000940/android-activity-has-leaked-window-com-android-internal-policy-impl-phonewindow/

转载于:https://www.cnblogs.com/butterfly-clover/p/6283826.html

你可能感兴趣的:(android.view.WindowLeaked)