I have been reading Android documentation (AsyncTask, Thread) and vogella tutorial about this matter, but I have doubts yet.
For example, I want to send a message from an Android app to a server. And I would like this process to be responsive. What should I use?
I have seen examples where they create a new Thread
for not block UI, but this way we don't have the progress of process, also you have to process the response within the Thread
because the run()
method doesn't returning anything.
AsyncTask
seems better option than Thread
, but I don't know what are the consequences of using an AsyncTask
instead of a Thread
.
AsyncTask
is for small tasks andThread
is for long tasks? Why shouldn't a person useAsyncTask
for long tasks? – Ovum