Saturday, June 26, 2010

[android-developers] Re: Sharing SQLite Database between activities

Probably the model that your looking for is a local service. Keep all
your interaction with the db in the one service. Open the db in
onCreate and close it in onDestroy. You can bind to it from multple
Activities - and if your service is still there when binding so is
your db without replicating code all over the place. Have a look at

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

Just one word of caution. Dont use a Binder as a non-static inner
class or you may leak the service.

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate