On Sun, Jun 3, 2012 at 10:04 AM, Greenhand <[email protected]> wrote: > For the communication between Activity and Service, I followed the > http://developer.android.com/guide/topics/fundamentals/bound-services.html#Messenger > to implement an Activity that binds a Service. > However, the Service will be killed and created when the Activity is > rotating. Is there a way to keep the Service running while rotating?
Don't unbind in the old activity instance -- only unbind from the new one. This will require you to bind using the Application object instead of some other Context. See: http://commonsware.com/blog/2010/09/29/another-use-getapplicationcontext-binding-rotation.html https://groups.google.com/group/android-developers/browse_frm/thread/35be7c74e43c5dfc/28658862573cb654 A retained fragment, instead of onRetainNonConfigurationInstance(), would be a variation on this pattern. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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

