如何在android默认音乐播放器中播放在线歌曲
我尝试下面的代码,但不能正常工作,我也尝试了这段代码如何在android默认音乐播放器中播放在线歌曲,android,Android,我尝试下面的代码,但不能正常工作,我也尝试了这段代码 Intent intent = new Intent(); ComponentName comp = new ComponentName("com.android.music","com.android.music.MediaPlaybackActivity"); intent.setComponent(comp); intent.setA
Intent intent = new Intent();
ComponentName comp = new ComponentName("com.android.music","com.android.music.MediaPlaybackActivity");
intent.setComponent(comp);
intent.setAction(Intent.ACTION_RUN);
startActivity(intent);
Uri myUri = Uri.parse(listSongUrl.get(position));
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(myUri, "audio/*");
startActivity(intent);