I got slightly confused about the differences between Asynctask
, Thread
, Service
, Loader
in Android.
I know how
It doesn't really matter, what abstraction you use, it boils down to a Thread
. So each of Android's async/parallel classes are using Thread
/Executor
behind the scenes, and have exactly the same potential problems, like locking, that the threads have.
The difference between then lies in its' usage. AsyncTask
for example, defines a handy completion-callback - onPostExecute()
. A CountDownTimer
allows you to control the time and so on.
You can use a plain Thread
of course, but in this case you have to invest more time in catching possible problems yourself.
So, Android provides you with a couple of right tools for right jobs.