官术网_书友最值得收藏!

Chapter 2. Performing Work with Looper, Handler, and HandlerThread

In the previous chapter, you were introduced to the most basic concurrent issues that a developer might face while developing a responsive and concurrent Android application. As the most interactable items run on the main thread, it is crucial to coordinate the backgrounds code to handle the work without any UI stuttering that compromises the user experience.

In this chapter, we will meet some of most fundamental constructs used on Android systems to perform tasks and schedule on a main thread or an ordinary background thread created by the developer to perform and schedule tasks long-running operations.

We will cover the following topics:

  • Understanding Looper
  • Understanding Handler
  • Sending work to Looper
  • Scheduling work with post
  • Using Handler to defer work
  • Leaking implicit references
  • Leaking explicit references
  • Updating the UI with Handler
  • Canceling pending messages
  • Multithreading with Handler and HandlerThread
  • Applications of Handler and HandlerThread
主站蜘蛛池模板: 贡嘎县| 清流县| 德钦县| 宁明县| 鄂托克旗| 安吉县| 台南县| 东源县| 靖宇县| 和田市| 纳雍县| 南平市| 金沙县| 交城县| 宣威市| 育儿| 铁岭县| 都江堰市| 伊吾县| 定襄县| 莆田市| 凤庆县| 黑山县| 永州市| 苏尼特左旗| 汕尾市| 铜川市| 洪泽县| 大宁县| 万宁市| 剑阁县| 平定县| 拜城县| 萝北县| 锡林浩特市| 兰溪市| 民县| 柳州市| 永兴县| 银川市| 偃师市|