Null Pointer Exception When Calling Getreadabledatabase()
I fairly new to the whole SQLite android implementation and I am clueless on what to do to get rid of this error. Essentially what I am trying to do with my database is save user d
Solution 1:
Get rid of most of your close()
methods that you are calling on SQLiteDatabase
. Notably, do not call close()
on the database passed to you in onCreate()
of SQLiteOpenHelper
, and do not keep opening and closing the database.
SQLiteOpenHelper
holds onto the database you retrieve with getReadableDatabase()
/getWritableDatabase()
, and the point is for you to reuse that opened SQLiteDatabase
object, particularly as you do work across multiple threads.
Post a Comment for "Null Pointer Exception When Calling Getreadabledatabase()"