Android 线程池系列教程(1)目录
Sending Operations to Multiple Threads
1.Dependencies and prerequisites
- Android 3.0 (API Level 11) or higher
- Loading Data in the Backgroundtraining class
- Running in a Background Servicetraining class
2.You should also read
3.Try it out
ThreadSample.zip
The speed and efficiency of a long-running, data-intensive operation often improves when you split it into smaller operations running on multiple threads. On a device that has a CPU with multiple processors (cores), the system can run the threads in parallel, rather than making each sub-operation wait for a chance to run. For example, decoding multiple image files in order to display them on a thumbnail screen runs substantially faster when you do each decode on a separate thread.
This class shows you how to set up and use multiple threads in an Android app, using a thread pool object. You'll also learn how to define code to run on a thread and how to communicate between one of these threads and the UI thread.
4.Lessons
- 4.1 Specifying the Code to Run on a Thread
- Learn how to write code to run on a separate
Thread
, by defining a class that implements theRunnable
interface. - 4.2 Creating a Manager for Multiple Threads
- Learn how to create an object that manages a pool of
Thread
objects and a queue ofRunnable
objects. This object is called aThreadPoolExecutor
. - 4.3 Running Code on a Thread Pool Thread
- Learn how to run a
Runnable
on a thread from the thread pool. - 4.4 Communicating with the UI Thread
- Learn how to communicate from a thread in the thread pool to the UI thread.
Android 线程池系列教程(1)目录的更多相关文章
- Android 线程池系列教程(5)与UI线程通信要用Handler
Communicating with the UI Thread 上一课 下一课 1.This lesson teaches you to Define a Handler on the UI Thr ...
- Android 线程池系列教程(2)Thread,Runnable是基类及如何写Run方法
Specifying the Code to Run on a Thread 上一课 下一课 1.This lesson teaches you to Define a Class that Im ...
- Android 线程池系列教程(4) 启动线程池中的线程和中止池中线程
Running Code on a Thread Pool Thread 上一课 下一课 1.This lesson teaches you to Run a Runnable on a Thre ...
- Android 线程池系列教程(3) 创建线程池
Creating a Manager for Multiple Threads 上一课 下一课 1.This lesson teaches you to Define the Thread Pool ...
- Android(java)学习笔记267:Android线程池形态
1. 线程池简介 多线程技术主要解决处理器单元内多个线程执行的问题,它可以显著减少处理器单元的闲置时间,增加处理器单元的吞吐能力. 假设一个服务器完成一项任务所需时间为:T1 创建线程时间, ...
- android线程池ThreadPoolExecutor的理解
android线程池ThreadPoolExecutor的理解 线程池 我自己理解看来.线程池顾名思义就是一个容器的意思,容纳的就是ThreadorRunable, 注意:每一个线程都是需要CPU分配 ...
- android 线程池的使用
转自http://www.trinea.cn/android/java-android-thread-pool/ Java(Android)线程池 介绍new Thread的弊端及Java四种线程池的 ...
- 《java.util.concurrent 包源码阅读》13 线程池系列之ThreadPoolExecutor 第三部分
这一部分来说说线程池如何进行状态控制,即线程池的开启和关闭. 先来说说线程池的开启,这部分来看ThreadPoolExecutor构造方法: public ThreadPoolExecutor(int ...
- Android(java)学习笔记211:Android线程池形态
1. 线程池简介 多线程技术主要解决处理器单元内多个线程执行的问题,它可以显著减少处理器单元的闲置时间,增加处理器单元的吞吐能力. 假设一个服务器完成一项任务所需时间为:T1 创建线程时间, ...
随机推荐
- enumerateObjectsUsingBlock 、for 、for(... in ...) 的差别 & 性能測试
for VS for(... in ...) for 的应用范围广基本能够NSArray.NSArray以及C语言的数组等,而for(... in ...)仅限于NSArray.NSArray等 fo ...
- Linux下怎么添加和查看PATH环境变量
linux下查看和添加PATH环境变量来自:http://apps.hi.baidu.com/share/detail/32942984 $PATH:决定了shell将到哪些目录中寻找命令或程序,PA ...
- Python函数参数传递
Python中函数参数的传递是采用传值方式,但是和C/C++有所不同 C/C++方式 void fun(int a) { a = 10; } void main() { int c =3; fun(c ...
- windows下的两个等待函数
windows下的两个等待技术 第一种: Win32 Sleep()函数 这个函数要求操作系统中止线程动作.直到读过某个指定的时间之后才恢复.能在某个线程结束时(而不是某段时间结束时)被调 ...
- Redis入门教程(二)— 基本数据类型
阅读以下内容时,手边打开一个redis-cli一起输入,输入命令敲击回车键前在心中想好你的答案,如果结果不合你的预期,请分析原因,使极大地提高学习效率.如果没有条件,每个数据类型后有代码运行结果,供你 ...
- showModalDialog参数问题
showModalDialog传递参数: 1.参数拼接放在url中,参数过长或带特殊字符时,容易出现问题. 2.参数放在showModalDialog属性里 <script type=" ...
- Servlet的引入
一.分析 此模式有问题: 1.jsp需要呼叫javabean StudentService stuService = new StudentServiceImpl(); List<Student ...
- Lightoj 1005 Rooks(DP)
A rook is a piece used in the game of chess which is played on a board of square grids. A rook can o ...
- [10.27_P2] 统计损失 (简单树形DP)
树形DP 简单题 Description 给定一棵树,每个节点有一个值.对于一条路径,它的值为路径上所有点的值的乘积.求出树上所有路径的值的和. 注意:单个点也算一条路径. Input 第 1 行一个 ...
- YTU 2858: 编程题AB-骨牌铺方格
2858: 编程题AB-骨牌铺方格 时间限制: 1 Sec 内存限制: 128 MB 提交: 87 解决: 23 题目描述 在2×n的一个长方形方格中,用一个1× 2的骨牌铺满方格,输入n ,输出 ...