Android Application Development Tutorial – 17 – Adding Music with MediaPlayer

Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –

Related Posts


  1. i am using android studio and after coding this uptill this video .. when i emulate this app . a dialog appears "Register New file type Association" and i have to associate .mp3 withsome given types.with what do i do that

  2. I know i'm a few years too late but I just have to write this…

    This tutorial might actually be bad for you in the long run, there are so many wrong explanations about programming concepts up to this point that i just couldn't bare with it anymore.

    For example:
    Keyword "this" is a reference to the current object, NOT the class as it was stated in this particular episode.

    the list goes on

    Basically you have to learn to crawl before you can run. Pick up some general programming tutorials or books, or even better go to a computer science college and come back in a few years once you have mastered programming in general and you will see that this tutorial makes no sense.

    This should be viewed as constructive criticism, you think you're helping people but actually you're making it harder for them in the long run.

    If you're here to learn Android development, look elsewhere.

  3. if i had a penny for every time you say for the most part. no just kidding. i realize it has to be hard to explain everything in detail. well FOR THE MOST PART. LOL. LOVE YOUR TUTORIALS

  4. it's not working ,when i right this (MediaPlayer ourSong=MediaPlayer.create(MyClass.this, R.); ) statement it is not giving me the reference of raw folder . i checked the file it doesn't contains any ref. to raw folder.

  5. If anybody has any issues with the app crashing as soon as it starts, try changing your file extension. Mine was .wma and when I converted it to .mp3 it worked fine.

  6. ok for people that have no sound going on I found the solution. You need to take the Splash out and just have this instead of Splash.this. Take out Splash and it will work.

    Correct version:
    ourSong = MediaPlayer.create(this, R.raw.tetris_theme);

    Incorrect Version:
    ourSong = MediaPlayer.create(Splash.this, R.raw.tetris_theme);

Leave a Reply

Your email address will not be published.

© 2022 Code As Pro - Theme by WPEnjoy · Powered by WordPress