Re: [android-developers] Re: Async Task or Spawn a Thread?

2011-05-10 Thread Satya Komatineni
I would say 1. Understand first how handler/looper/threrading works in android 2. Then you will realize that AsyncTask is just one pattern on top of the above basics 3. Try to use AsyncTask if it can work for your problem as it simplifies the mechanics of threading/handlers. if not then go for

Re: [android-developers] Re: Async Task or Spawn a Thread?

2011-05-10 Thread Dianne Hackborn
On Tue, May 10, 2011 at 6:30 AM, Satya Komatineni satya.komatin...@gmail.com wrote: Coming to thread pools the latest documentation seem to suggest that after honeycomb the AsyncTask may roll back to a single thread implementation and have the programmer deal with multiple threads

[android-developers] Re: Async Task or Spawn a Thread?

2011-05-09 Thread Bob Kerns
I'm OK with having people who aren't very experienced with threads create a new AsynchTask for each recurrence. Better than debugging a synchronization problem -- or worse, living with it. And it's not really that high an overhead, either in code complexity or time and memory. It's not like

Re: [android-developers] Re: Async Task or Spawn a Thread?

2011-05-09 Thread Mark Murphy
On Mon, May 9, 2011 at 6:34 AM, Bob Kerns r...@acm.org wrote: Just to be clear: Handler/Looper doesn't give you threads. No, though there is HandlerThread, a Thread with a baked-in Handler. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy

[android-developers] Re: Async Task or Spawn a Thread?

2011-05-08 Thread Indicator Veritatis
All the answers I have seen so far are true, but yours is the most informative. I would be a little careful about the generalization though, that if he has to ask, then AsyncTask is the answer. AsyncTask is not so convenient for recurring tasks, unless you are OK with having to start it up all

[android-developers] Re: Async Task or Spawn a Thread?

2011-05-07 Thread Bob Kerns
Use an AsyncTask -- unless both of the following are true: - AsyncTask doesn't meet your needs somehow - You know very clearly and well how to properly synchronize between threads, and how to transfer work to the UI thread where needed, etc. If AsyncTask doesn't meet your needs, and