-3

what is the best for working with java web service and Android client between thread and asynctask ?

Shihab
  • 83
  • 1
  • 3
  • 10

1 Answers1

1

Use AsyncTask for:

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

Use Java threads for:

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

synchronization with the main thread if you post back results to the user interface No default for canceling the thread No default thread pooling No default for handling configuration changes in Android

Ameer
  • 2,709
  • 1
  • 28
  • 44