07.05.2011 19:53, Droid пишет:
Seems I can use an async task OR roll my own thread to do a background
task.

Is one better than the other?

Not "better", mostly just plug into the rest of your code somewhat differently.

AsyncTask provides helpers methods, like onPreExecute, onProgressUpdate, which are conveniently called on the UI thread - Thread does not have those.

AsyncTask is not reusable, once it's executed, you will need to create a new one to execute a new work item. A thread can be written such that it gets work items from a queue, staying running.

AsyncTasks are executed in parallel prior to 3.0, and in 3.0 the default execution model is one task at a time (which can be changed). A thread is independent of other threads.

AsyncTask is faster and easier to get going, a Thread is a bit more work.

Neither AsyncTask nor Thread affect your process's lifetime.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to