The problem I have not located will therefore try to be as specific as possible because the compiler does not throw any errors and when it passes through the debugger test, either, but in some cell phones a very peculiar error occurs which I have tried at least identify but I do not give with the answer
In some cell phones when I create many MediaPlayer some at the time of being reproduced do not work, to be more clear I will put the code that is explained by itself.
sonido1 = MediaPlayer.create(this,R.raw.sonido1);
sonido2 = MediaPlayer.create(this,R.raw.sonido2);
sonido3 = MediaPlayer.create(this,R.raw.sonido3);
sonido4 = MediaPlayer.create(this,R.raw.sonido4);
Example event click and start of a MediaPlayer
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(sonido1.isPlaying() ){
sonido1.pause();
sonido1.seekTo(0);
btn1.setBackgroundColor(Color.parseColor("#ffb806"));
}else{
sonido1.seekTo(0);
sonido1.start();
btn1.setBackgroundColor(Color.parseColor("#e1a206"));
}
}
});
The problem is that in some cell phones it works without problem and when I compile it or test it with a debugger there are no errors that I can observe however in some cell phones when there are many sounds the last ones do not reproduce as they should. Example the sound18.
I hope I have been as clear and specific as possible.