That's right. If you start an AsyncTask from a Service, you can't use the UI
thread methods of the AsyncTask to access the UI thread. Many of the usages
of AsyncTask are from an Activity, not a Service. They are used to respond
to user events that would take too long to process in the UI thread, such as
fetching some data. Hence the progress callback which is handy for
displaying a progress bar while the AsyncTask is in process.

I don't know much about Services yet, but i suspect that many newbies think
they need to use a service for any background process. Services are commonly
used to periodically poll for updates in the background. They need to post
events the the UI thread if they want to display something to the user.
Services can also run AsyncTask, AFAIK, but that not a frequent usage.

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

Reply via email to