Android学习:UI线程规则+经典异常

一:看程序二:可以创建一个新的线程执行阻塞部分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线程之外的其他线程中,对视图中的组件进行设置。

经典异常:Only the original thread that created a view hierarchy can touch its views.只有创建view的那个线程才能对其进行修改。

不能接受失败,也意味太想去成功了,从心理学上解释,

Android学习:UI线程规则+经典异常

相关文章:

你感兴趣的文章:

标签云: