Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 仅在纵向模式下泄漏的IntentReceiver_Android_Android Intent_Memory Leaks_Broadcastreceiver - Fatal编程技术网

Android 仅在纵向模式下泄漏的IntentReceiver

Android 仅在纵向模式下泄漏的IntentReceiver,android,android-intent,memory-leaks,broadcastreceiver,Android,Android Intent,Memory Leaks,Broadcastreceiver,在发布任何解决方案之前,我要求您仔细阅读 问题: 面对下面的例外 03-12 14:13:20.936: E/ActivityThread(6629): Activity com.sec.android.app.videoplayer.activity.VPVideoPlayer has leaked IntentReceiver com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$3@424e3698 that

在发布任何解决方案之前,我要求您仔细阅读

问题:

面对下面的例外

03-12 14:13:20.936: E/ActivityThread(6629): Activity
com.sec.android.app.videoplayer.activity.VPVideoPlayer has leaked IntentReceiver
com.android.internal.policy.impl.multiwindow.MultiPhoneWindowEvent$3@424e3698 that
was originally registered here. Are you missing a call to unregisterReceiver()?
当用户通过活动之一打开视频并在视频结束后将屏幕方向从横向切换到纵向时,应用程序将不幸关闭

目前仅在三星n 8000设备中观察到

搜索后:

我得到的每个解决方案都与
registerReceiver
unregisterReceiver
有关。但是活动中的代码没有类似的内容。因此不知道应该如何解决它

场景:

支持我的
activity1
调用
activity2

所有活动
screenOrientation=“横向”

现在假设
活动2
如下所示:

public class activity2 extends Activity {

  @Override
   public void onCreate(Bundle savedInstanceState) {
        //initialize UI
            ....
       /*call asynctask to download file(file can be of any format i.e.pdf,
        video,etc)*/
      try {
                new DownloadAndOpenFile().execute(filePath);
          } catch (Exception e) {
                e.printStackTrace();
          }
      }
   }
下载文件后,将使用以下方法打开该文件:-

public void openDownloadedFile(String filePath) {
        try {

            Uri data = Uri.parse(filePath);

            String type = getMimeType(data.toString());

            Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
            intent.setDataAndType(data, type);
            startActivity(intent);

        } catch (Exception e) {
            e.printStackTrace();
            AlertDialog alertDialog = AlertDialogBox.alertDialog(this,
                    "No Supported Application found to open this file");
            alertDialog.show();
        }
    }
视频完成后,控件应转到
Activity1
,因此
Activity2
onRestart()
如下所示:

@Override
    protected void onRestart() {

        super.onRestart();
        Log.d(tag, "In onRestart");
        finish();
    }
很明显,一定是出了什么问题。但我不知道如何纠正它。
请帮助找到上述问题的相关解决方案


提前感谢您的帮助。

您在哪里注册接收者?如果需要更多信息,请告诉我\@Kalyan:没有涉及接收者。.该代码在横向模式下工作正常VPVideoPlayerCheckkout的Post代码存在同样的问题