我正在尝试在android studio中创建MediaPlayer,但在编译时它给出了
"unfortunately project has stopped"
代码如下:
MediaPlayer M = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
M = MediaPlayer.create(MainActivity.this,R.raw.laugh);
}
public void play1(View view) {
M.start();
}