I've got quite a problem with MediaPLayer, i have really no idea, why this code doesn't work! Btw. it doesn't work either on Samsung Galaxy Ace or emulator :( just getting "The application org.me.androidapplication11(process org.me.androidapplication11) has stopped unexpectedly. Please try again." help please!
package org.me.androidapplication11;
import android.app.Activity;
import android.os.Bundle;
import android.media.MediaPlayer;
public class MainActivity extends Activity {
private MediaPlayer mPlayer;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mPlayer=MediaPlayer.create(this,R.raw.as);
mPlayer.start();
}
}
You can debug your app using logcat. I don't know if you're developing in Eclipse, but if you are, this link might help you.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.