Android SQLite - close() was never explicitly called on database

ERROR/SQLiteDatabase(15541): android.database.sqlite.DatabaseObjectNotClosedException: Application did not close the cursor or database object that was opened. Here is how to resolve...

Changes to your android activity's onDestroy() method

@Override
protected void onDestroy() {
 super.onDestroy();
 if (dbHelper  != null) {
  dbHelper.close();
 }
}

Changes to your Database Adapter

public void close() {
 if (mDbHelper != null) {
  mDbHelper.close();
 }
}

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.