cyberguijarro cyberguijarro - 9 months ago 107
Android Question

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.

Answer Source

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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download