I have made an android application in that i want to play a continuous audio in background.I have done successfully to start the audio,but when i stop the audio it starts again.My code is as below,Please suggest me any solution.. code
public static void PlayMusic(Context context){
mediaPlayer = MediaPlayer.create(context, R.raw.saturday);
if(!mediaPlayer.isPlaying()){
mediaPlayer.start();
Toast.makeText(context,
"soundPool.pause()",
Toast.LENGTH_LONG).show();
}
else {
mediaPlayer.stop();
Toast.makeText(context,
"soundPool.pause()",
Toast.LENGTH_LONG).show();
}
}
Aucun commentaire:
Enregistrer un commentaire