在页面上:
http://developer.android.com/guide/topics/media/mediaplayer.html
关闭该页面的示例代码:
添加以下两项内容:
import android.R.raw;
getApplicationContext();
MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext();, R.raw.sound_file_1);
mediaPlayer.start(); // no need to call prepare(); create() does that for you
问题?: R.raw.sound_file_1
参数MediaPlayer.create
如何将其定义为文件,例如/dev/sda1/mediafile.xxx
感谢您提前提供任何帮助...... Michael
答案 0 :(得分:0)
您可以传递Uri
作为第二个参数。要创建Uri
,请执行以下操作:
Uri uri = Uri.create("/dev/sda1/mediafile.xxx")
然后将其传递给MediaPlayer.create()
,如此:
MediaPlayer mediaPlayer = MediaPlayer.create(getApplicationContext(), uri)