Facebook活动中泄露的窗口

时间:2015-06-27 09:12:14

标签: android facebook android-activity facebook-sdk-4.0

当我在我的活动中使用facebook登录按钮时,logcat会显示此信息。我不明白为什么这个出现我检查了整个班级从来没有找到参考。

06-27 14:17:45.819  12019-12019/com.ets.medecord E/WindowManager﹕ Activity com.facebook.FacebookActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4054a518 that was originally added here
    android.view.WindowLeaked: Activity com.facebook.FacebookActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@4054a518 that was originally added here
            at android.view.ViewRoot.<init>(ViewRoot.java:259)
            at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
            at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
            at android.view.Window$LocalWindowManager.addView(Window.java:465)
            at android.app.Dialog.show(Dialog.java:241)
            at com.facebook.internal.WebDialog$DialogWebViewClient.onPageStarted(WebDialog.java:500)
            at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:264)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:130)
            at android.app.ActivityThread.main(ActivityThread.java:3835)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:507)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
            at dalvik.system.NativeStart.main(Native Method)

查看活动代码http://pastebin.com/qQqbvX6g

1 个答案:

答案 0 :(得分:0)

如果Dialog未正确使用(例如在跳转到另一个活动之前未完成),则经常会发生窗口泄漏异常。 Google已经提醒开发人员,DialogFragment是比Dialog更好的选择。