Hi
I want to display player position and player duration in simple date format. that is. 00:00:01/00:00:06. The first part is current position of the player and the second part is the duration.
I have used SimpleDateFormat to try display the duration and position in this format, but it is showing me the output as 05:30:00/05:30:06.
Here is the code I am using:
time1 = new SimpleDateFormat("HH:mm:ss");
currentTime.setText("" + time1.format(player.getCurrentPosition());
How do I print out the position and duration correctly? (It is displaying hours/minutes that should not be there).
Kindly help me out, Swathi Daruri.
DateFormatworks for dates, not for time intervals. So if you get a position of 1 second, the DateFormat interprets this as meaning that the date/time is 1 second after the beginning the calendar (which is January 1st, 1970).You’d need to do something like
And then do something like