I would recommend having a static singleton objects that is used to access
the database -- it creates the database when it is first retrieved as part
of its initialization, allows clients to get the database and/or provides
convenience APIs for interacting with the database, and simply stays around
forever (until the process is killed).

On Fri, Feb 26, 2010 at 10:07 PM, Paul <[email protected]> wrote:

> What is the best approach to managing a small SQLite database private
> to the application?
> Open (getWritableDatabase) in OnStart and close in OnStop in each
> Activity?
> Open in OnCreate and keep open til the user quits the app (where would
> you put close?)
> Open, do work and close as soon as possible each time it is needed?
>
> --
> 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]<android-developers%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
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

Reply via email to