Just be careful closing the database - if you have multiple threads sharing an instance of a single SQLiteOpenHelper, the SQLiteDatabase mDatabase isn't like a jdbc connection pool.
If you close it fron one thread, it's closed for real. ...and of course, if you don't close it, it whines. Larry On Thu, Mar 7, 2013 at 8:07 AM, Mark Murphy <[email protected]> wrote: > On Thu, Mar 7, 2013 at 9:54 AM, Saurav <[email protected]> wrote: >> How many SQLiteOpenHelper instances should be created? Should there be just >> one and should it be reused? > > Ideally, yes, particularly if you are planning on accessing the > database from multiple threads. One SQLiteOpenHelper instance means > one SQLiteDatabase instance, and SQLiteDatabase is designed to manage > operations from multiple threads. > > -- > Mark Murphy (a Commons Guy) > http://commonsware.com | http://github.com/commonsguy > http://commonsware.com/blog | http://twitter.com/commonsguy > > _The Busy Coder's Guide to Android Development_ Version 4.6 Available! > > -- > -- > 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 > --- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

