这里先给一个处理时间格式的代码:
/**
* 时间的处理
*
* @param time
* @return
*/
public static String getTimeFromInt(int time) {
if (time <= 0) {
return "0:00";
}
int secondnd = (time / 1000) / 60;
int million = (time / 1000) % 60;
String f = String.valueOf(secondnd);
String m = million >= 10 ? String.valueOf(million) : "0"
+ String.valueOf(million);
return f + ":" + m;
}
下面是:
滑动条控制代码:
bar = (SeekBar) findViewById(R.id.seekBar);
bar.setOnSeekBarChangeListener(this);
int progress;
@Override
public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) {
// TODO Auto-generated method stub
System.out.println("目前位置:" + arg1);
progress = arg1;
// player.seekTo(progress);
}
@Override
public void onStartTrackingTouch(SeekBar arg0) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar arg0) {
// TODO Auto-generated method stub
player.seekTo(progress);
}