I’m am trying to make my App play a Default android
Sound Once my timer has counted down.
I have searched through numerous articles on here,
and the code i have come up with is…
public void playAlertSound(int sound){
MediaPlayer mp = MediaPlayer.create(getBaseContext(), sound);
mp.start();
mp.setOnCompletionListener(new OnCompletionListener()
{ @Override public void onCompletion(MediaPlayer mp) {
mp.release();
}
});
}
And This is called after the timer has ended by using –
playAlertSound(R.raw.beep1);
However beep1 is obviously not a default sound.
This is probably a file someone has added to their project.
Where do i add an mp3 file called beep1.mp3 in my project so the
above line will work?
Or is there a default sound i can call??
Any help much appreciated..
Thanks for looking.
add beep1.mp3 file in
rawfolder in your project.means
create raw folder in res for that right click on res and create folder raw.In that place your
beep1.mp3file.Hope it helps.