1. Are you ready for the Galaxy S20? Here is everything we know so far!

Android Mediaplayer class - onCompletion never called

Discussion in 'Android Development' started by Android_Chris, Sep 27, 2014.

  1. Android_Chris

    Android_Chris Lurker
    Thread Starter

    I'm building an app that has a music player that streams music from a website. The music is playing fine, but I want to have the next song automatically played when one song is finished. I am importing

    "android.media.MediaPlayer.OnCompletionListener"

    , am declaring

    "implements OnCompletionListener"

    in the Activity definition, am calling

    "mp.setOnCompletionListener(this);"

    in the onCreate(), and have coded

    "public void onCompletion(MediaPlayer arg0)"

    But the onCompletion method is never being called. I set breakpoints inside the method to try and determine why my code wasn't producing the expected results, but the method is just never called when one song ends.

    Does anyone know what the problem might be? Before I had the music streaming from the internet, I had it playing files from the R.raw folder, and the same problem existed.

    I don't know how to debug this, because it's a method that should be called automatically and is just never being called.
     



    1. Download the Forums for Android™ app!


      Download

       
  2. Manaya

    Manaya Member

    Do you have @Override before public void onCompletion(MediaPlayer arg0)?
     
  3. Android_Chris

    Android_Chris Lurker
    Thread Starter

Loading...
Similar Threads - Android Mediaplayer class
  1. APVBri
    Replies:
    0
    Views:
    103
  2. montecarlo1987
    Replies:
    1
    Views:
    205
  3. Srapisar
    Replies:
    4
    Views:
    257
  4. ironass
    Replies:
    1
    Views:
    254
  5. ironass
    Replies:
    1
    Views:
    244
  6. ironass
    Replies:
    1
    Views:
    270
  7. Mike00709
    Replies:
    3
    Views:
    245
  8. Luca Bertoncello
    Replies:
    0
    Views:
    240
  9. sam_windsor
    Replies:
    10
    Views:
    525
  10. ironass
    Replies:
    2
    Views:
    423

Share This Page

Loading...