Re: [android-developers] Re: AsyncTask vs. IntentService

2011-09-28 Thread stanlick
Right! So by way of consensus is there a technique and/or pattern that handles the nuances surrounding a one-and-done background task? Seems like a documented pattern for such a common use case would benefit developers and app users alike. On Wed, Sep 28, 2011 at 10:58 AM, Mark Murphy wrote: >

Re: [android-developers] Re: AsyncTask vs. IntentService

2011-09-28 Thread Kostya Vasilyev
Actually, the comment in DetachableResultReceiver.java has this to say about config changes: /** * Proxy {@link ResultReceiver} that offers a listener interface that can be * detached. Useful for when sending callbacks to a {@link Service} where a * *listening {@link Activity} can be swapped out d

Re: [android-developers] Re: AsyncTask vs. IntentService

2011-09-28 Thread Mark Murphy
On Wed, Sep 28, 2011 at 11:41 AM, stanlick wrote: > Wouldn't this suffer the same fate when the activity experienced a > configuration change? You probably pass the ResultReceiver to the new instance via onRetainNonConfigurationInstance(). Make sure the ResultReceiver does not have an implicit re

[android-developers] Re: AsyncTask vs. IntentService

2011-09-28 Thread stanlick
Wouldn't this suffer the same fate when the activity experienced a configuration change? On Sep 27, 5:00 pm, Streets Of Boston wrote: > > IntentService dispenses with the > > configuration changes but leaves you in a lurch when requiring a > > response. > > In addition to Mark's suggestions, you

Re: [android-developers] Re: AsyncTask vs. IntentService

2011-09-28 Thread Mark Murphy
On Wed, Sep 28, 2011 at 2:36 AM, Nikolay Elenkov wrote: > The iosched app seems to be using one: > > http://code.google.com/p/iosched/source/browse/android/src/com/google/android/apps/iosched/util/DetachableResultReceiver.java > http://code.google.com/p/iosched/source/browse/android/src/com/google

Re: [android-developers] Re: AsyncTask vs. IntentService

2011-09-27 Thread Nikolay Elenkov
On Wed, Sep 28, 2011 at 7:03 AM, Mark Murphy wrote: > On Tue, Sep 27, 2011 at 6:00 PM, Streets Of Boston > wrote: >> In addition to Mark's suggestions, you could assign a ResultReceiver to one >> of the Intent's extras: >> Your Activity could implemented this ResultReceiver's onReceiveResult >> m

Re: [android-developers] Re: AsyncTask vs. IntentService

2011-09-27 Thread Mark Murphy
On Tue, Sep 27, 2011 at 6:00 PM, Streets Of Boston wrote: > In addition to Mark's suggestions, you could assign a ResultReceiver to one > of the Intent's extras: > Your Activity could implemented this ResultReceiver's onReceiveResult > method. > Your IntentService could just call 'send(resultCode,

[android-developers] Re: AsyncTask vs. IntentService

2011-09-27 Thread Streets Of Boston
> IntentService dispenses with the > configuration changes but leaves you in a lurch when requiring a > response. In addition to Mark's suggestions, you could assign a ResultReceiver to one of the Intent's extras: Your Activity could implemented this ResultReceiver's *onReceiveResult * method. Y