westmeadboy wrote: > Interesting. So, essentially, anything that cannot be passed in the > Intent could be passed via a local service. Is this a common tactic in > general?
I can't say whether or not it's common. It's certainly something I recommend here and there. > What are the main advantages over just setting the objects as statics > on the secondary activity? Well, they have their pluses and minuses. > One, is the situation where the activity is killed and then restarted > by the system. I'm guessing that the local service approach would be > able to handle this better. Actually, that's one of the minuses, IMHO. A static data member survives the rotation. The service, however, will shut down mid-rotation if there are no other bound connections to it. Right now, you have to manage the orientation change yourself and avoid destroying the activity. However, the problem with the static data member is figuring out when it is safe to null out the static reference (for GC purposes) and who's supposed to do it. > The main thing which puts me off the local service is the extra layer > and extra things that can go wrong. Extra care needed in stopping the > local service etc. So long as you figure out when to null out the static reference, you do not necessarily need the service. You just asked for alternatives, so I gave you one. :-) -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android Development Wiki: http://wiki.andmob.org -- 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

