Bender,

put your db in a local Service. Open the db in onCreate() close it in
onDestroy(). Your Activities can bind and unbind to the Service as
many times as you like. The system will keep the service running as
long as  you have an activity in the foreground process bound to it or
otherwise until it needs to reclaim the resources.

Take a look at :

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/app/LocalService.html

but DONT have your binder as a non-static inner class as in the
example - or you will create a memory leak and leak your Service.
Instead, pass the binder a reference to your service in onCreate and
get the binder to null the reference out in onDestroy

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to