一:看程序
二:可以创建一个新的线程执行阻塞部分
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(50000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
三:现象
点击button2,不会影像button1,button1继续移动。
四:规则
There are simply two rules to Android‘s single thread model:
(1)Do not block the UI thread.不要阻塞UI线程
(2)Do not access the Android UI took it from outside the UI thread.
不要在UI线程之外的其他线程中,对视图中的组件进行设置。
原文地址:http://blog.csdn.net/u013628152/article/details/43794813