-1

I want to load data from server, from my android application, I want to know that which will be best to load data from server, Thread or AsyncTask. Thanks

Imtiaz Ali
  • 302
  • 1
  • 3
  • 8

1 Answers1

0

AsyncTask is better.

For better understanding You should have to know the use of both:

AsyncTask:

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

Threads

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

And here is the ref. of my answer and some other useful links:

Link 1

Link 2

Link 3

Community
  • 1
  • 1