MediaPlayer.getCurrentPosition () - Get the Current Playback Position in an Audio File

How to Get the Current Playback Position in an Audio File

MediaPlayer.getCurrentPosition() was added in API Level 1
Gets the current playback position. Returns the current position in milliseconds

2. Declare an Integer named intCurrentPosition right after the public class and initialize it to 0. This will be a integer variable for the Media Player Position, in milliseconds.

3. In the MainActivity.java file, add the following code to the onCreate method. 

intCurrentPosition = myMediaPlayer.getCurrentPosition();
Toast.makeText(getBaseContext(), "myMediaPlayerCurrentPosition: " + myMediaPlayer.getCurrentPosition(), Toast.LENGTH_SHORT).show();

4. Compile and run!

Next Recommended Article:

Related Articles:

Resources:
http://developer.android.com/reference/android/media/MediaPlayer.html#getCurrentPosition()
http://stackoverflow.com/questions/16163431/android-mediaplayer-audio-seekbar