如何将用户发送到Android中的视频播放器?

时间:2013-12-18 06:00:23

标签: android video

我读过这篇文章: Sending the User to Another App

如果用户点击按钮,并且应该将它们发送到视频播放器观看视频,那么有人可以告诉我应该在Intent的构造函数中添加什么内容吗?我将mp4文件的路径设为String

1 个答案:

答案 0 :(得分:2)

尝试以下代码

File file=new File(filepath);
Uri uriToFile=Uri.fromFile(file);

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToFile);
shareIntent.setType("*/mp4");
startActivity(Intent.createChooser(shareIntent,"Send to"));