I think that's an overkill for a simple database.  I thought the main
reason for a ContentProvider was to make your data available to an
external entity.

You need to close the database as you cannot pass an open database
connection between activities, as far as I can tell.

On Jul 23, 6:32 am, Joseph Earl <[email protected]> wrote:
> I agree it's not well documented what to do when opening/closing the
> DB from within an activity.
>
> Instead implement a ContentProvider which opens your database and
> provides access to it.
> Your activities will then never need to worry about opening/closing
> the DB.
>
> On Jul 22, 3:54 pm, Doug Gordon <[email protected]> wrote:
>
>
>
> > I've seem some conflicting posts on this, so will ask it simply here. Is
> > it really necessary to close an SQLite database that your activity has
> > opened (database is in local memory or on SD card)?
>
> > I would think it would be good practice, but I noticed that the Android
> > samples such as the Notepad tutorial and SearchableDictionary sample do
> > not do this. I've also seen sample code where the database is
> > consistently opened, read from, and closed, but that would seem to add
> > unnecessary overhead.
>
> >   Doug Gordon
> >   GHCS Systems- Hide quoted text -
>
> - Show quoted text -

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