I'm trying to launch the music player so it will launch and immediately start playing the first song. im using an Intent but it just doesn't work...it says "no activity found to handle intent".
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
//"songsList" is an array with paths of all the songs in the sdcard
Uri uri = Uri.parse(songsList.get(0));
String type = "audio/mp3";
intent.setDataAndType(uri, type);
startActivity(intent);
Why not use
android.intent.action.MUSIC_PLAYER
?Note that this is deprecated from API 15, FROM API upwards you can use
android.intent.category.APP_MUSIC
.ok so i find this code that works
but the thing is that lets say that the user hits the back button and then hits the button of the music player, it restarts the player and starts playing the first song again... so how do i just launch the music player without anything else...?
To launch default music player, please try with below code.