1
我想单击按钮的同时用音频文件更新我的ProgressBar。我也使用了根据音频文件长度在几秒钟内运行的定时器。使进度条与计时器同步
我配置了定时器,它根据音频文件的长度很好地增加,但是我的ProgressBar不工作。它给了我NumberFormatException。
我的代码: class MyCount extends CountDownTimer { private int mycount;
public MyCount(long millisInFuture, long countDownInterval)
{
super(millisInFuture, countDownInterval);
}
public void onFinish()
{
//timeDisplay.setText("done!");
}
public void onTick(long millsIncreasing)
{
mycount++;
mystring = formatTime(mycount*1000);
myText.setText(mystring);
pBar.setProgress(Integer.parseInt(mystring)); (*****)
pBar.setProgress(1000 * pBar.getProgress());
/*String myString1 = mystring.substring(0, mystring.lastIndexOf(":")).trim();
String myString2 = mystring.substring(mystring.lastIndexOf(":")+1, mystring.length()).trim();*/
我得到了异常,我已经在支架上显示星星。 任何人可以帮我, 感谢 大卫
请问您可以发布`formatTime`函数的代码吗?它会返回一个合成的Integer吗? – 2010-12-06 07:22:56