Search code examples
androidmedia-player

show time when song is playing in android


i am trying to play a song by using MediaPlayer from the given list.i want include time duration for the song from starting to ending of the song. how to add time and how to update that time from 0:00 to till the end of that song


Solution

  • You can use the method getCurrentPosition() which gives you the current position in milliseconds.

    You can also use the method getDuration() to get the full length of the song.

    You can use a separate thread to update the timer.