Demonstrating  Step by
step  how to play the audio voice in
Android application.
1.      
Create a folder inside of resource folder and
put the audio file.
2.      
Declare the variable for media player
private
MediaPlayer backgroundSound;
3.      
Creating the object of  voice file;
backgroundSound =
MediaPlayer.create(this,R.raw.background);
4.      
Start the Sound;
  backgroundSound.start();
5.      
Stopping the sound
backgroundSound.stop();
6.      
Setting the loop of sound to repeat the sound nonstop.
backgroundSound.setLooping(true);

 
No comments:
Post a Comment