开发者

how to find if the song is ended in android

开发者 https://www.devze.com 2023-03-02 21:07 出处:网络
i use MediaPlayer in android and i am playing a song by start method and i have to find if the son开发者_C百科g is ended not paused or stop. . please help me.Please implement onCompletion Listener .

i use MediaPlayer in android and i am playing a song by start method and i have to find if the son开发者_C百科g is ended not paused or stop. . please help me.


Please implement onCompletion Listener .

mediaPlayer.setOnCompletionListener(this);

When song is ended then media player automatically called onCompletion method.

public void onCompletion(MediaPlayer arg0) 
{
    // Write your code
}


You have to register OnCompletionListener using setOnCompletionListener method. When the song is played endCompletion will be called.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号