Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-21 Thread Streets Of Boston
Managed means that a lot of stuff is going on in the background that you don't have to worry about. E.g. - You don't have to create threads. Just subclass the AsyncTask/Loader/IntentService and implement/override the correct method and your code will run in some background thread.

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-21 Thread Kristopher Micinski
I typed this on a phone, but I'm not sure why that autocomplete was appropriate.. kris On Wed, Mar 20, 2013 at 8:11 PM, Nikolay Elenkov nikolay.elen...@gmail.com wrote: On Thu, Mar 21, 2013 at 3:48 AM, Kristopher Micinski krismicin...@gmail.com wrote: Loafers are built on top of asynctasks.

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-21 Thread Kristopher Micinski
I guess a higher level point is that there are some basic rules you have to follow regarding threading contexts, and these aren't specified and checked within code. E.g., you can't modify UI elements from a background thread, only the main thread can do this. Every Android app has a blessed main

[android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Harish
There are differences - Loader managed by fragment/activity, if you feel trouble managing task between configuration changes, other interruption (phone ring) or any other, use Loader and let Fragment/activity will mange pause/restart/reattach . Where ever possible try to use Loader -

[android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread b0b
I use...java.util.concurrent.* classes. AsyncTask is just a specific usage of these classes. Avoid creating and managing threads yourself. Use Executors instead. -- -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this

[android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Streets Of Boston
There are even more ways of doing stuff in the background: IntentService :-) - Runnable If you mean a Thread (running itself or a Runnable): Generally, avoid using them. But there are good use cases: When you want to setup something that runs in the background for a long time

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Kristopher Micinski
Though it's worth noting that since an `IntentService` doesn't run in a background thread context. (Probably one of the biggest things beginners screw up..) Kris On Wed, Mar 20, 2013 at 9:49 AM, Streets Of Boston flyingdutc...@gmail.com wrote: There are even more ways of doing stuff in the

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Streets Of Boston
The onStart/onStartCommand methods of a *Service *run in the main UI thread, not a background thread, But an *IntentService*'s onHandleIntent method does run in a pooled background thread (pool has only one thread, and subsequent Intents are handled sequentially). On Wednesday, March 20, 2013

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Kristopher Micinski
Ah that's right, forgive my comment. On Mar 20, 2013 12:03 PM, Streets Of Boston flyingdutc...@gmail.com wrote: The onStart/onStartCommand methods of a *Service *run in the main UI thread, not a background thread, But an *IntentService*'s onHandleIntent method does run in a pooled background

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Kristopher Micinski
That's what I get for not reading the documentation before speaking. :-) On Mar 20, 2013 12:59 PM, Kristopher Micinski krismicin...@gmail.com wrote: Ah that's right, forgive my comment. On Mar 20, 2013 12:03 PM, Streets Of Boston flyingdutc...@gmail.com wrote: The onStart/onStartCommand

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Chang Sheng-Dean 章聖典
Thank you all for the kind and enthusiastic responses; they were all very insightful to help my understanding of Android concurrency =D In many of these responses, many spoke of threads being *managed* for you. This term is very vague to me because in the Ref pages for AsyncTask and Loaders,

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Kristopher Micinski
Loafers are built on top of asynctasks. They manage the gui vs. background threads for you. If you just *read* the reference page to which you link, it should describe the procedure. The main idea is that you can publish results on UI elements and still do background work, with coordination

Re: [android-developers] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-20 Thread Nikolay Elenkov
On Thu, Mar 21, 2013 at 3:48 AM, Kristopher Micinski krismicin...@gmail.com wrote: Loafers are built on top of asynctasks. +1 for 'loafers' :) -- -- 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] Re: Concurrency: Do you use Loaders? AsyncTask? or Runnables?

2013-03-19 Thread G. Blake Meike
They really are fairly different. Loaders are managed AsyncTasks. AsyncTasks are (pretty much) managed Runnables. Use loaders if you can. See: http://stackoverflow.com/questions/15463146/is-using-asynctask-still-recommended-for-loading-listview-items-in-the-backgroun/15463279#15463279