Android 播放器开发之seekBar
2010-11-05 00:55:44 来源:WEB开发网while(true){
try {
sleep(milliseconds);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mHandle.sendEmptyMessage(0);
}
}
}
//拖动进度条更新
public void startProgressUpdate(){
//开辟Thread 用于定期刷新SeekBar
DelayThread dThread = new DelayThread(100);
dThread.start();
}
private Handler mHandle = new Handler(){
@Override
public void handleMessage(Message msg){
int position = mediaPlayer.getCurrentPosition();
int mMax = mediaPlayer.getDuration();
int sMax = seekBar.getMax();
seekBar.setProgress(position*sMax/mMax);
}
};
public class DelayThread extends Thread {
int milliseconds;
public DelayThread(int i){
milliseconds = i;
}
public void run() {
while(true){
try {
sleep(milliseconds);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
mHandle.sendEmptyMessage(0);
}
}
}
android sqlite
更多精彩
赞助商链接