AndroidIntent.ACTION_VIEW [英] Android Intent.ACTION_VIEW
本文介绍了AndroidIntent.ACTION_VIEW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要用户选择自己的播放器来播放视频,然后尝试
I need to user choice their own player to play video and I try
public class VideoViewActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String videoUrl = "http://someurl/video.mp4";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(videoUrl));
startActivity(i);
}
但是在我的示例活动中,打开浏览器而不是当前安装的播放器列表. 我应该使用哪个Intent选项?有可能吗?
But in my example activity open browser not a list of current installed player. Which option of Intent I should use? Is it possible?
推荐答案
请尝试以下代码.
String videoUrl = "http://someurl/video.mp4";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(videoUrl),"video/mp4");
startActivity(i);
这篇关于AndroidIntent.ACTION_VIEW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文