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进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。