为什么在意图播放视频后停止app?

时间:2015-09-25 16:52:39

标签: android android-intent video

我尝试通过意图播放视频。我用这个方法:

   private void play_video() {
Intent intent = new Intent();
intent.setAction(android.content.Intent.ACTION_VIEW);
File file = new File(Environment.getExternalStorageDirectory().getPath() + "/nabege" + File.separator + "video"
        + File.separator + videoFileName);
intent.setDataAndType(Uri.fromFile(file), "video/*");
startActivity(intent);}

结束时播放视频停止应用。

09-25 15:47:02.772: E/ActivityThread(31449): Activity com.android.gallery3d.app.MovieActivity has leaked IntentReceiver com.android.gallery3d.app.MovieActivity$6@41b61bf8 that was originally registered here. Are you missing a call to unregisterReceiver()?
09-25 15:47:02.772: E/ActivityThread(31449): android.app.IntentReceiverLeaked: Activity com.android.gallery3d.app.MovieActivity has leaked IntentReceiver com.android.gallery3d.app.MovieActivity$6@41b61bf8 that was originally registered here. Are you missing a call to unregisterReceiver()?
09-25 15:47:02.772: E/ActivityThread(31449):    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:837)
09-25 15:47:02.772: E/ActivityThread(31449):    at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:608)

我在Internet上搜索,我知道我最常使用registerReceiver()和unregisterreceiver()方法。现在我不明白如何使用这两种方法。请指导我

1 个答案:

答案 0 :(得分:1)

您的堆栈跟踪来自另一个应用,而非您的应用:

Activity com.android.gallery3d.app.MovieActivity has leaked IntentReceiver com.android.gallery3d.app.MovieActivity$6@41b61bf8 that was originally registered here. Are you missing a call to unregisterReceiver()?

您没有编写名为com.android.gallery3d.app.MovieActivity的活动。这是播放视频的第三方应用。显然,你在该应用程序中看到了一个错误。你无能为力。