Background processing Handler OR AsyncTask

Put your problem here if it does not fit any of the other categories.

Background processing Handler OR AsyncTask

Postby rahultims@gmail.com » Thu Jan 06, 2011 9:47 am

Hello,
My android app deals with lots of http calls.
For this I have created a thread in Application which only deals with HTTP calls.
There are two handler, one for UIs and other the HTTP thread handler.
Also I differentiate between HTTP requests by message bundle key "method"

My concern is "is it effecient as far as CPU/resources are concerned"

Asynctask may be other option. But there are n number of requests then there is n number of threads created.
Please enlighten me about asynctask pool size per activity.
Please help make my decision among best technique.
rahultims@gmail.com
Freshman
Freshman
 
Posts: 2
Joined: Thu Jan 06, 2011 9:37 am

Top

Re: Background processing Handler OR AsyncTask

Postby jonbonazza » Fri Jan 07, 2011 4:55 am

I don't believe either is more efficient than the other, but if one is, then I would guess it would be the Thread/Handler combo. On top of all of this, Threads are much easier to work with than AsyncTask in my opinion. AsyncTask just seems a bit too... limited...
jonbonazza
Master Developer
Master Developer
 
Posts: 665
Joined: Thu Jul 15, 2010 2:58 pm
Location: WV USA

Re: Background processing Handler OR AsyncTask

Postby rahultims@gmail.com » Fri Jan 07, 2011 6:49 am

ya, I also agree vth you.
Thread. Runnable and Handler combination is very flexible
Thanks
rahultims@gmail.com
Freshman
Freshman
 
Posts: 2
Joined: Thu Jan 06, 2011 9:37 am

Re: Background processing Handler OR AsyncTask

Postby antonykk » Tue Mar 08, 2011 7:34 am

rahultims@gmail.com wrote:Hello,
My android app deals with lots of http calls.
For this I have created a thread in Application which only deals with HTTP calls.
There are two handler, one for UIs and other the HTTP thread handler.
Also I differentiate between HTTP requests by message bundle key "method"

My concern is "is it effecient as far as CPU/resources are concerned"

Asynctask may be other option. But there are n number of requests then there is n number of threads created.
Please enlighten me about asynctask pool size per activity.
Please help make my decision among best technique.


Both are good only, but if you are using the Async in the listview means, it is not nice, because upto the job is completed we can't stop it. In that case we can use the runnable thread, runnable thread is very easy view this site http://android-codes-examples.blogspot. ... hread.html
antonykk
Freshman
Freshman
 
Posts: 8
Joined: Tue Jan 04, 2011 8:24 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 16 guests