Android中的Thread和AsyncTask之间最好的是什么?

时间:2015-04-15 12:42:23

标签: android multithreading android-asynctask

在线程和asynctask之间使用java Web服务和Android客户端最好的是什么?

1 个答案:

答案 0 :(得分:1)

使用AsyncTask:

Simple network operations which do not require downloading a lot of data
Disk-bound tasks that might take more than a few milliseconds

使用Java线程:

Network operations which involve moderate to large amounts of data (either uploading or downloading)
High-CPU tasks which need to be run in the background
Any task where you want to control the CPU usage relative to the GUI thread

For Thread

  

如果您将结果发回到主线程,则与主线程同步   用户界面取消线程无默认值无默认线程   pooling在Android中处理配置更改没有默认值