我的项目有一个按钮。每次单击按钮时,我都想为媒体播放器分配一首新歌。我遇到了错误:无法解决方法' setDatSource(java.io.File)'
final MediaPlayer mPlayer1 = MediaPlayer.create(MainActivity.this, R.raw.bass);
b.setOnLongClickListener(new View.OnLongClickListener() {
@Override
public boolean onLongClick(View v) {
try {
mPlayer.setDataSource(Environment.getExternalStorageDirectory());
}catch(Exception e){
e.printStackTrace();
}
return false;
}
});