I agree with you, static members don't have to be a manace regarding GC, but they do carry the memory leaks danger if you don't treat them well, i close the cursor and null the instance in onDestroy and recreate it in onCreate.
However in a big complicated program with a lot of code it's a needless hazard, i do agree to that. Doesn't the extra service adds to the code complexity ? adds to the accumulated application memory, after all it's also a component that consumes resources. I find it kind of frustrating that i cannot get instance of an activity or one of it's inner classes without a static member, as i said they live in the same memory space... On Apr 7, 6:03 pm, "Mark Murphy" <mmur...@commonsware.com> wrote: > > Isn't that an overkill ? create a service to share a single cursor > > between 2 activities ? if it were a generic service that i used to > > share many cursor from many queries (lets say it's a query management > > service) and several activities will use it then i can understand the > > efficiency and code simplicity in it, for more simple examples it > > sounds like an overkill. > > The other options you cited are bad for performance (putting the Cursor in > an Intent extra) or are risky from a garbage collection standpoint (using > mutable static data members). > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > Android App Developer Books:http://commonsware.com/books.html -- 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@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en