gpt4 book ai didi

java - Eclipse 视频 Intent 视频

转载 作者:行者123 更新时间:2023-12-01 05:02:03 29 4
gpt4 key购买 nike

我对此很陌生,我在这里的论坛上检查过答案,但我没有找到任何真正可以帮助我的答案。我正在尝试播放 res/raw 文件夹中的视频。到目前为止我已经设置了这段代码:

MediaPlayer mp; 

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videoview);
ListView l1 = (ListView) findViewById(R.id.listview);
l1.setAdapter(new EfficientAdapter(this));
l1.setOnItemClickListener(new OnItemClickListener() {
//Starts up a new activity, based on what listitem you press.
public void onItemClick(AdapterView<?> a, View v, int position, long id) {

Intent intent = new Intent(VideoButtonActivity.this, com.example.norskattrack.VideoActivity.class);

if(position==0){
System.out.println("Item 0");

intent.putExtra("video", 1);
startActivity(intent);
}
if(position==1){
System.out.println("Item 1");

intent.putExtra("video", 2);
startActivity(intent);
}
}
});
}

最佳答案

Uri video = Uri.parse("android.resource://com.package.app/raw/videoname");

这应该可以让您播放原始文件夹中的视频!

看看:

How to play videos in android from assets folder or raw folder?

Play Video From Raw Folder

Trying to play video from raw folder (VideoView)

所有人都有出色的答案!

关于java - Eclipse 视频 Intent 视频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13269007/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com