How do i get a .wav sound to play?
android, audio, file, java, wav
Solution
doesn't the `android.media.MediaPlayer` class do this?
Reference: http://developer.android.com/reference/android/media/MediaPlayer.html
Example: http://developer.android.com/guide/topics/media/index.html
Step 2 of the example says:
MediaPlayer mp = MediaPlayer.create(context, R.raw.sound_file_1);
mp.start();
In your case, I'd use the `onStart()` inside your Activity class:
public class MyActivity extends Activity {
...
protected void onStart() {
super.onStart();
MediaPlayer mp = MediaPlayer.create(this, R.raw.sound_file_1);
mp.start();
}
...
}
Problem
Im making an app, and i want it to make a sound when a activity is opened , the sound file is in `R.raw.sound_file` , if someone could do some example code to make my app play a sound that would be great.