handler.post(runnable)的方式的思考
mHandler1.post(new Runnable() {
@Override
public void run() {
//如果这个run方法是死循环,那么,handler2post的线程就不会被执行了
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
textView.setText("handler1");
}
}
});
mHandler2.post(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
textView.setText("handler2");
}
});