-3
在線程和asynctask之間使用java web服務和Android客戶端的最佳方式是什麼?Android中的Thread和AsyncTask之間的最佳方式是什麼?
在線程和asynctask之間使用java web服務和Android客戶端的最佳方式是什麼?Android中的Thread和AsyncTask之間的最佳方式是什麼?
使用的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
線程
與主線程同步,如果你回髮結果給 用戶界面沒有默認線程取消線程沒有默認線程 pooling沒有默認用於處理Android中的配置更改
另外它取決於您的要求。 –
原始帖子,你可以在這裏 http://stackoverflow.com/questions/18480206/asynctask-vs-thread-in-android –