A friend gave my an idea, I thought if doing a query twice in the past, one for the first list and the other once a row was chosen, since i don't use projects parameter the queries are not efficient, however if for the first list i need just two rows and for the second i take only a single column (or if i'll use certain columns from certain rows) it'll be more efficient so all i need to do is pass on the _ID parameter in the intent.
Of course this is a solution for cursors only and for certain type of queries, not for all of them. For bigger amount of data needs to be shared among activities maybe the service solution remains best... On Apr 7, 6:10 pm, poohtbear <[email protected]> wrote: > 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" <[email protected]> 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 [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 To unsubscribe, reply using "remove me" as the subject.

