How to start MusicPlayer without specifying any music file in Android
In my app, I want to launch standard Music Player (with its full UI) when a button is pressed but I dont want to specify any file. I just want to open the player and then user can use it however they want. So the standard way of using intent with ACTION_VIEW
and specifying media file will not work for me. So how can I launch this? Is 开发者_C百科there another way?
Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
You can set the intent explicitly to the Music Player activity.
Intent intent = new Intent(getApplicationContext(), yourclass.class)
I think it should be com.android.Music.MediaPlaybackActivity.class
but I'm not so sure about that part. If you want the browser, replace the activity with MusicBrowserActivity
精彩评论