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

Summary

In this chapter, we learned how to use Handler to queue work for the main thread and how to use Looper to build up a queueing infrastructure for our own Thread.

We saw the different ways in which we can define work with Handler: arbitrary work defined at the call site with Runnable or predefined work implemented in the Handler itself and triggered by message-sending.

In the meantime, we learned how to defer work properly without leaking memory on the way.

We learned how to use Handler in a multithreaded application to pass work and results back and forth between cooperating threads, performing blocking operations on an ordinary background thread and communicating the results back to the main thread to update the user interface.

In the next chapter, we'll start to build responsive applications by applying the AsyncTask instance to execute work in the background using pools of threads and returning progress updates and results to the main thread.

主站蜘蛛池模板: 淮阳县| 筠连县| 花垣县| 石河子市| 商河县| 德阳市| 隆尧县| 瑞昌市| 麻城市| 庄浪县| 阿克苏市| 都安| 霍林郭勒市| 梧州市| 博白县| 微山县| 方山县| 友谊县| 柳林县| 博乐市| 达州市| 灵丘县| 犍为县| 廉江市| 葫芦岛市| 聂荣县| 扶余县| 吉隆县| 额济纳旗| 惠东县| 达孜县| 彩票| 吕梁市| 东莞市| 台东县| 呼玛县| 宾阳县| 宁南县| 且末县| 五台县| 邯郸县|