开发者

Playing audio files in android

I need to play long audio files using the Android SDK. I am aware of the MediaPlayer framework shipped by Android, but I was开发者_开发知识库 wondering wether the built-in "Music Player" application could be invoked, so I don't have to write my own player GUI and code.


Yes, you can.
Set up an intent like this:

act=android.intent.action.VIEW dat=file:///mnt/sdcard/song_name.mp3 typ=audio/mpeg3

Action: VIEW

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri
                .parse("file:///mnt/sdcard/song_name.mp3"),
                "audio/mpeg3");
startActivity(intent);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜