第十章:后台默默的劳动者-探究服务

  1. 不能在自定义线程中更新 UI,系统本身不允许
  2. 如果想在自定义线程中更新 UI,需要使用 Handler 机制。上一章中的 runOnUiThread 方法也是对 Handler 机制的一种包装
  3. AsyncTask 背后的原理也是基于异步消息处理机制的
  4. 活动绑定服务,通过活动中的 ServiceConnection 链接到服务中的 Binder 实例

源码

源码见:https://github.com/optor666/first-line-code-of-android/tree/master/chapter10

猜你喜欢

转载自www.cnblogs.com/optor/p/9060929.html
今日推荐