Android Development Starter Guide using Android Studio
Adding Sound


Step 1:
Add a sound file (e.g. spacesound.mp3) to your project by copying and pasting it into your res folder.  Put it under the raw folder when asked. If doesn't exist, create it.







Step 2:
Once it is in, you can use the following code to play the sound in your activity class. Make sure to adjust to the name of your sound file in the code.


MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.spacesound);
mediaPlayer.start();