If you bind with the application context, it will be fine.

On Thu, Sep 23, 2010 at 6:18 PM, Mark Murphy <[email protected]>wrote:

> In an earlier thread on this group, it was pointed out that it is safe
> to pass a properly-constructed AsyncTask object from an old activity
> to a new one via onRetainNonConfigurationInstance(), so we can keep
> the background work running when the device changes orientation, dock
> status, etc.
>
> What about ServiceConnection?
>
> In other words, if an activity is bound to a service, is there a way
> we can keep the binding alive during the configuration change, by
> passing a properly-constructed ServiceConnection from the old activity
> to the new? Or do we have to unbind in the old activity and bind again
> in the new one?
>
> Since ServiceConnection is just an interface, it should be fairly
> trivial to have that object be clean for passing via
> onRetainNonConfigurationInstance(). I'm just not sure if there's
> something else held inside Android's innards that might get confused
> if we do this.
>
> Thoughts?
>
> Thanks!
>
> --
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> _The Busy Coder's Guide to Android Development_ Version 3.1 Available!
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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