Need Help In Mediaplayer Class
I've recently trying to build a simple android project. It will play a sound when the user click a button. When it was successfully compiled, the sound won't come off. I think it i
Solution 1:
hi jason you r stopping and releasing as soon as the player is started. So stop it once it is completed. hopefully this code will help you
final MediaPlayer mPlayer=MediaPlayer.create(getBaseContext(), R.raw.reload);
mPlayer.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
//new Toast(getBaseContext());
mPlayer.release();
mPlayer = null;
}
});
Post a Comment for "Need Help In Mediaplayer Class"