I am new in android, i use to work with asynk task mostly, there is Handlers also, when read differences between thread, asynk task and Handler i confuse why should not use only Handler if handler can do every thing just for one difference i.e. Asynk task initialize on UI thread and Handler can initialize from any. Please some give me the situation when to use Asynk task and when not and why? same with Handler?
You are mistaking with handler. Handlers
are used to communicate between two threads
. To achieve function what Asynctask is used to achieve you have to use handler and thread together
as thread
will be used to do background processing
while handler
will be used to update UI accordingly
. While both of this tasks can be performed by asynctask itself.Hope this clears a thing a bit.
Also you can refer this link for further clarifications Handlers and Thread