您好,登錄后才能下訂單哦!
private Runnable mRunnable = new Runnable() {
public void run() {
while (true) {
if (mThread == null) {
return;
}
try {
Thread.sleep(1000);
mHandler.sendEmptyMessage(0x11);
mHandler.sendEmptyMessage(0x12);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
private Handler mHandler = new Handler() {
public void handleMessage(Message msg) {
super.handleMessage(msg);
switch(msg.what){
case 0x11:
refreshUI_1();
break;
case 0x12:
refresh_2();
break;
}
}
};
private void refreshUI_1() {
if(count1 == 10){
edt1.setText("線程1 結束");
mThread = null;
return;
}
edt1.setText(count1+"");
count1 ++;
}
private void refresh_2(){
if(count2 == 100){
edt2.setText("線程2 結束");
mThread = null;
return;
}
edt2.setText(count2+"");
count2 += 10;
}
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。