Thanks Mark, you have always been a charm!
Thanks Larry, that was new info.
So, what I take from your answers is that I can open a (Helper) connection
at start of the application and close it at the application close, using
the same connection for getting Readable and Writable db instances?
And
Yes, that sounds right.
I generally tie an instance to the lifecycle of the class that uses it.
That assures that it is only open as long as it's needed and that it's
closed when it isn't.
Larry
On Fri, Mar 8, 2013 at 4:16 AM, Saurav to.saurav.mukher...@gmail.comwrote:
Thanks Mark, you have
Hi All,
How many SQLiteOpenHelper instances should be created? Should there be just
one and should it be reused? Or do I create an instance for each of my
Usecase/ operation?
Thanks in advance!
Regards,
Saurav Mukherjee.
Twitter https://twitter.com/#!/fasuke
Facebook
On Thu, Mar 7, 2013 at 9:54 AM, Saurav to.saurav.mukher...@gmail.com 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
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
5 matches
Mail list logo