简体   繁体   中英

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);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM