I just made the Database objects singletons as suggested by Mark. What a fantastic idea -- this solved so many of my problems and complexity in my app. My app deals with a user configurable number of databases (like files in a desktop app) and switching between them was a pain in the b*tt.
This solved all my issues related to screen rotation, services accessing the database, etc. Highly recommended for anybody. The only problem is that the datrabase is never closed. But this is more of a pedentic observation as there seems to be no real side effects. I do wish there were a onDestory() on the Application object so I could close the databases before Android terminates my app, but alas, there isn't. Of course, creating a Content Provider is deseriable, but non- practicle. My app deals with very complex queries and since there is currently no reason to expose my data to the outside world, a Content Provider is not only very complicated to create, but it's also unneccessary. Thanks again to Mark. On Oct 11, 4:48 pm, rich friedel <rich.frie...@gmail.com> wrote: > @Zsolt Vasvari Just a quick thought for you... Consider closing stuff like > the database/database adapter in your onPause() method of the Activity. > onPause is always called where onDestroy is called whenever, thus the > database might still be "open" when it is expected to be closed. I tend to > close close, unregister, etc.. stuff in the onPause and open, register them > in the onResume methods. -- 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