int currentPosition = mediaPlayer.getCurrentPosition() / 1000; //把播放时长换算成秒
//直接除以60取余就是秒数
int ms = currentPosition % 60;
String m = String.valueOf(ms);
if (ms < 10){
m = "0" + m;
}
//计算出分钟
int mi = currentPosition / 60 % 60;
String mn = String.valueOf(mi);
if (mi < 10){
mn = "0" + mn;
}
String showTime = mn + "." + m;
网友评论