- Asynchronous Android Programming(Second Edition)
- Helder Vasconcelos
- 155字
- 2021-07-14 10:43:13
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
推薦閱讀
- Java程序設(shè)計實戰(zhàn)教程
- Mastering JavaScript Object-Oriented Programming
- 自己動手實現(xiàn)Lua:虛擬機(jī)、編譯器和標(biāo)準(zhǔn)庫
- Python for Secret Agents:Volume II
- Rust編程從入門到實戰(zhàn)
- 跟小海龜學(xué)Python
- 看透JavaScript:原理、方法與實踐
- Learning Laravel 4 Application Development
- Java軟件開發(fā)基礎(chǔ)
- Learning JavaScript Data Structures and Algorithms
- PySpark Cookbook
- ASP.NET程序開發(fā)范例寶典
- 計算機(jī)應(yīng)用基礎(chǔ)教程(Windows 7+Office 2010)
- 基于GPU加速的計算機(jī)視覺編程:使用OpenCV和CUDA實時處理復(fù)雜圖像數(shù)據(jù)
- Android for the BeagleBone Black