2
Good morning, I’m with a project so that when a button is pressed it will perform a predetermined sound
however if I press a dps button on the other, it gets both sounds ringing, I tried to if in case something is playing it pause and get the other
however it crashes the app while trying to check if there is nothing touching
if anyone knows a way to make 2 sounds not play at the same time I am very grateful :D
public void nelson (View view) {
mp = MediaPlayer.create(this, R.raw.nelson);
mp.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
public void onCompletion(MediaPlayer mp) {
mp.stop();
mp.release();
mp = null;
}
});
mp.start();
}
Post the code of the two buttons, it will be easier to give an answer.
– ramaral
ready put
– Matheus Muriel