Android Application Development Tutorial - 17 - Adding Music with MediaPlayer
Why Stack Overflow recommends it
Stack Overflow users link it as the tutorial they were following when their MediaPlayer splash-sound code crashed, and as a starting point for learning the MediaPlayer class.
Recommended by 1 people across 1 different months, 2014 to 2015.
What it is
Episode 17 of thenewboston's Android application development tutorial series. It shows how to add sound to an app using the MediaPlayer class, playing a song during a splash screen activity. The video is a short screen-recorded walkthrough of the code.
What people said
Recommends Taimoor Ali · 2014-01 · Stack Overflow · on “how to import video and audio libaries”
First Go for the this [LINK] Read the documentation , discover a little about the Media Player class that is what are its Fields , is it a subclass and finally the Interface Then here are some links : [this video] [LINK] [LINK] [LINK]
Cites Stnz · 2014-07 · Stack Overflow · on “Why does my android app crash after adding a sound using MediaPlayer”
I have been following this video tutorial here [this video] to add sound to a 5 second splash activity(?) that occurs when the app starts up. Prior to editing the app with the new sound additions detailed in the video the app was working perfectly fine and displaying the image stored in the R.layout.splash xml file My app was working and the code was pretty much exactly the same as the code in the video at the start. However, after following this video and making the advised changes, the app crashes before showing either the image or sound (no significant information given in any error messages, just that the app has crashed). I did clean the project again after adding the audio file. The audio f
Cites TempAcc · 2015-04 · Stack Overflow · on “Android MediaPlayer: start method crashing”
I'm following the thenewboston 's tutorials, but I came to a part where while my code is seemingly the same as the guy's in the video, it does not work. public class Splash extends Activity{ MediaPlayer ourSong; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.splash); MediaPlayer.create(Splash.this, R.raw.splashsound); ourSong.start(); Thread timer = new Thread(){ public void run(){ try{ sleep(5000); } catch (InterruptedException e){ e.printStackTrace(); }finally{ Intent openStartingPoint = new Intent("com.example.tutorial.STARTINGPOINT"); startActivity(openStartingPoint); } } }; tim