But what's the reason for not keeping it open?  Or actually a better
question is why do is my database dependent on an activity at all?  These
are two totally different pieces to the puzzle (i.e. as in an MVC pattern or
similar design).



On Wed, Jul 21, 2010 at 8:29 PM, Zsolt Vasvari <[email protected]> wrote:

> I never keep an actualy SQLiteDatabase object around ever.  In all my
> activities, I create a helper object and obtain the SQLDatabase object
> which I keep around throwing away the helper object.  And I make sure
> that I close the database in my activities' onDestroy method.
>
> On Jul 22, 4:07 am, ecforu <[email protected]> wrote:
> > Do I need an instance of my SQLiteOpenHelper class for each Activity I
> have?
> >  I have 1 currently that all activities access, but started getting an
> > exception
> >
> > "illegal state exception SQLiteDatabase created and never closed "
> >
> > on simple a simple query and I can't seem to figure out why this is
> > happening.  I read online about this, and wanted to try to understand why
> > the SQLiteOpenHelper was dependent on an Activity.
> >
> > Is there a way to just have open SQLiteDatabase object without the Helper
> > and have it just exist within all activities?
> >
> > Thanks
>
> --
> 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

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