WEB开发网
开发学院手机开发Android 开发 Android 播放器开发之seekBar 阅读

Android 播放器开发之seekBar

 2010-11-05 00:55:44 来源:WEB开发网   
核心提示:while(true){try {sleep(milliseconds);} catch (InterruptedException e) {// TODO Auto-generated catch blocke.printStackTrace();}mHandle.sendEmptyMessage(0);}}}//拖

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

上一页  1 2 

Tags:Android 播放器 开发

编辑录入:coldstar [复制链接] [打 印]
赞助商链接