[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-24 Thread gcstang
Thank you, I'll check this out

On Jul 23, 10:08 am, Brion Emde brione2...@gmail.com wrote:
 The Notebook sample application contains a simple ContentProvider and
 a list of Notes.

 That lives 
 here:http://developer.android.com/resources/samples/NotePad/index.html

 On Jul 23, 9:09 am, gcstang gcst...@gmail.com wrote:

  Does anyone have a easy example to setup the ContentProvider and a
  psuedo helper object for use with a ListView?

  I would be interested in seeing that.

  Thank you in advance

  On Jul 23, 1:50 am, Indicator Veritatis mej1...@yahoo.com wrote:

   Passing data from Activity to Activity is what ContentProviders are
   good at; they even let you pass from application to application.

   On Jul 22, 5:24 pm, Zsolt Vasvari zvasv...@gmail.com wrote:

You cannot pass a SQLiteDatabase object from activity to activity.
Perhaps you could store it in a global static, but I think that's not
a good idea.

On Jul 22, 11:18 pm, ecforu ecforus...@gmail.com wrote: 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 zvasv...@gmail.com 
 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 ecforus...@gmail.com 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 
  android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubs­­cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en-Hidequotedtext-

 - Show quoted text -- 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-23 Thread Indicator Veritatis
Passing data from Activity to Activity is what ContentProviders are
good at; they even let you pass from application to application.

On Jul 22, 5:24 pm, Zsolt Vasvari zvasv...@gmail.com wrote:
 You cannot pass a SQLiteDatabase object from activity to activity.
 Perhaps you could store it in a global static, but I think that's not
 a good idea.

 On Jul 22, 11:18 pm, ecforu ecforus...@gmail.com wrote: 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 zvasv...@gmail.com 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 ecforus...@gmail.com 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 android-developers@googlegroups.com
   To unsubscribe from this group, send email to
   android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubs­cr...@googlegroups.com
   For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en-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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-23 Thread gcstang
Does anyone have a easy example to setup the ContentProvider and a
psuedo helper object for use with a ListView?

I would be interested in seeing that.

Thank you in advance

On Jul 23, 1:50 am, Indicator Veritatis mej1...@yahoo.com wrote:
 Passing data from Activity to Activity is what ContentProviders are
 good at; they even let you pass from application to application.

 On Jul 22, 5:24 pm, Zsolt Vasvari zvasv...@gmail.com wrote:

  You cannot pass a SQLiteDatabase object from activity to activity.
  Perhaps you could store it in a global static, but I think that's not
  a good idea.

  On Jul 22, 11:18 pm, ecforu ecforus...@gmail.com wrote: 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 zvasv...@gmail.com 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 ecforus...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubs­cr...@googlegroups.com
For more options, visit this group at
   http://groups.google.com/group/android-developers?hl=en-Hidequoted 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-23 Thread Brion Emde
The Notebook sample application contains a simple ContentProvider and
a list of Notes.

That lives here: 
http://developer.android.com/resources/samples/NotePad/index.html

On Jul 23, 9:09 am, gcstang gcst...@gmail.com wrote:
 Does anyone have a easy example to setup the ContentProvider and a
 psuedo helper object for use with a ListView?

 I would be interested in seeing that.

 Thank you in advance

 On Jul 23, 1:50 am, Indicator Veritatis mej1...@yahoo.com wrote:



  Passing data from Activity to Activity is what ContentProviders are
  good at; they even let you pass from application to application.

  On Jul 22, 5:24 pm, Zsolt Vasvari zvasv...@gmail.com wrote:

   You cannot pass a SQLiteDatabase object from activity to activity.
   Perhaps you could store it in a global static, but I think that's not
   a good idea.

   On Jul 22, 11:18 pm, ecforu ecforus...@gmail.com wrote: 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 zvasv...@gmail.com 
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 ecforus...@gmail.com 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 
 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubs­­cr...@googlegroups.com
 For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en-Hidequotedtext 
-

- Show quoted text -- 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-22 Thread gcstang
I still see this error when using a ListView even though I have it set
to close and clean up the connection when leaving the view, can't do
it right away or the ListView won't work.

Any way around this?

On Jul 21, 7:29 pm, Zsolt Vasvari zvasv...@gmail.com 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 ecforus...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: SQLiteOpenHelper per activity??

2010-07-22 Thread ecforu
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 zvasv...@gmail.com 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 ecforus...@gmail.com 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 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-22 Thread Joseph Earl
Use a ContentProvider, together with an SQLiteOpenHelper wrapper
around your database.
Your activities will then never need to worry about opening or closing
the database at all.

On Jul 22, 4:18 pm, ecforu ecforus...@gmail.com wrote:
 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 zvasv...@gmail.com 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 ecforus...@gmail.com 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 android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
  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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-22 Thread Zsolt Vasvari
You cannot pass a SQLiteDatabase object from activity to activity.
Perhaps you could store it in a global static, but I think that's not
a good idea.

On Jul 22, 11:18 pm, ecforu ecforus...@gmail.com wrote:
 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 zvasv...@gmail.com 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 ecforus...@gmail.com 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 android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.comandroid-developers%2bunsubs­cr...@googlegroups.com
  For more options, visit this group at
 http://groups.google.com/group/android-developers?hl=en- 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: SQLiteOpenHelper per activity??

2010-07-21 Thread Zsolt Vasvari
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 ecforus...@gmail.com 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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en