Thread v/s Async task [duplicate]
P开发者_开发问答ossible Duplicate:
Difference between Service, Async Task & Thread?
I am downloading around 600 images. I want this task to run in background, which method is the best method for it. Async or thread? Can anyone please tell me?
Do you plan on post processing after downloading the images? If you create a background thread and your main thread exits before the background threads are complete, then the threads will be aborted IN MOST Programming languages. It shouldnt really matter what method you choose if you create a barrier to prevent your programming from exiting until all your images are downloaded. I would run background threads off a threadpool.
AsyncTask. Just use it and you'll see why it better than threading... Threading just introduces another layer of complexity. The goal is to reduce complexity.
ETA: If possible, include as many as possible with the APK... 600 images is a ton for poor 3G and his/her merry dial-up like speeds.
Here is an article comparing various task execution mechanisms in Android.
精彩评论