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.<init>(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/

posted @ 2017-01-13 19:01  Michelle's Home  阅读(463)  评论(0编辑  收藏  举报