I am a Soundboard application developer. Many users told me that in their phones some of the sounds were cut off earlier. I have a Nexus One and HTC Tattoo, and everything works fine, I never noticed that it was turned off on my phones.
This is my code for the audio part:
Firstly, I have a MediaPlayer object in my main class:
private MediaPlayer mp = null;
And when I click the button, this is the code:
private OnClickListener onClickSound = new OnClickListener() {
public void onClick(View v) {
if(mp != null){
mp.stop();
mp.release();
mp = null;
}
mp = MediaPlayer.create(getBaseContext(), mp3id));
mp.start();
mp.setOnCompletionListener(completionListener);
}
};
And this will be finalListener:
MediaPlayer.OnCompletionListener completionListener = new MediaPlayer.OnCompletionListener(){
public void onCompletion(MediaPlayer mediaP) {
if(mp != null && !mp.isPlaying()){
mp.stop();
mp.release();
mp = null;
}
}
};
Do you have any clues?
Hi
source
share