开发者

Rounding of the value of the Audio File duration with the ProgressBar

I have configured the Progress Bar in my Application with the Audio File. All the audio files are in the Seconds, Now where am I stuck is the Pro开发者_开发百科gress Bar only shows the progress with the audio file upto the fixed value.

I mean if the duration of the file is supposedly "5760"(in milliseconds) then the Progress Bar will show the progress upto only "5000" milliseconds and then the space will be seen empty for the rest "760" milliseconds.

I want the Progress Bar to get Synchronized fully and to show the Progress Bar complete according to the length of the Audio file.

Can anybody please help me in this particularly.

Thanks, david


As far as I can see the android progressbar should be able to show progress upto any int value, I was wondering, did you set

setMax(int max)

to the right value, ie. 5760


You can round off the value by using following code:

NumberFormat nf = NumberFormat.getInstance();
nf.setMaximumFractionDigits(2);
textView.setText(nf.format(mediaPlayer.getCurrentPosition()/100000.0).toString())
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜