while working on thread in android I came across runnable and handler. My question is, what is the better option to use AsyncTask
or Thread
(or Runnable
) for multi-threading. I found using AsyncTask
very easy and efficient.
As far as my concern ,if you need to run short operations you can use AsyncTask.To keep threads running for long periods of time, it is highly recommended you use the various APIs provided by the java.util.concurrent pacakge such as Executor, ThreadPoolExecutor and FutureTask.You can also refer http://developer.android.com/reference/android/os/AsyncTask.html