E / WindowManager:android.view.WindowLeaked:Activity

时间:2017-08-02 07:13:27

标签: java android android-fragments android-intent

  

E / WindowManager:android.view.WindowLeaked:Activity   com.anonyme.anonyme.EditProfileActivity已泄露窗口   com.android.internal.policy.impl.PhoneWindow $ {DecorView 44781360   V.E ..... R .....我。最初添加的0,0-1080,1776}                                                                                   在android.view.ViewRootImpl。(ViewRootImpl.java:352)                                                                                   在   android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:248)                                                                                   在android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)                                                                                   在android.app.Dialog.show(Dialog.java:294)                                                                                   在   com.anonyme.anonyme.Fragment.ChatFragment.displayCameraPreviewImage(ChatFragment.java:1134)                                                                                   在   com.anonyme.anonyme.Fragment.ChatFragment.onActivityResult(ChatFragment.java:786)                                                                                   在   android.support.v4.app.FragmentActivity.onActivityResult(FragmentActivity.java:164)                                                                                   在   com.anonyme.anonyme.MainFragmentActivity.onActivityResult(MainFragmentActivity.java:648)                                                                                   在android.app.Activity.dispatchActivityResult(Activity.java:5423)                                                                                   在android.app.ActivityThread.deliverResults(ActivityThread.java:3465)                                                                                   在   android.app.ActivityThread.handleSendResult(ActivityThread.java:3512)                                                                                   在android.app.ActivityThread.access $ 1300(ActivityThread.java:144)                                                                                   在   android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1294)                                                                                   在android.os.Handler.dispatchMessage(Handler.java:102)                                                                                   在android.os.Looper.loop(Looper.java:212)                                                                                   在android.app.ActivityThread.main(ActivityThread.java:5151)                                                                                   at java.lang.reflect.Method.invokeNative(Native Method)                                                                                   在java.lang.reflect.Method.invoke(Method.java:515)                                                                                   在   com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:868)                                                                                   在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:684)                                                                                   在dalvik.system.NativeStart.main(本地方法)

片段:

    private void displayCameraPreviewImage(Intent responseData){
            final Dialog dialogCamera = new Dialog(generalPropListener.getSelfContext(),
                    android.R.style.Theme_Black_NoTitleBar_Fullscreen);
        dialogCamera.setContentView(R.layout.viewimagefullscreen);
        dialogCamera.show();
    }

目前我在dialogCamera.show();面临这个错误我读了很多解决方案,但是无法弄清楚在哪里解雇这个对话框...而且也不知道为什么我需要解雇这个对话框,即使我创建了实例仅在此方法中..

1 个答案:

答案 0 :(得分:0)

最后我解决了我的问题..感谢您的回复..我需要做的就是关注;

  1. 将对话框设置为全局成员

    Dialog dialogCamera;

  2. 在构造函数中初始化

    this.dialogCamera = new Dialog(generalPropListener.getSelfContext(), android.R.style.Theme_Black_NoTitleBar_Fullscreen);

  3. 在我的行动中调用show()

    private void displayCameraPreviewImage(Intent responseData){ dialogCamera.show(); }

  4. OnPause()我需要关闭对话框

    if (dialogCamera != null) {
        dialogCamera.dismiss();
    }