im trying to save a row in my settings table, it works all fine and dandy except when i kill the app and then try to get the row back it cant find it
Cursor c = db.query(savedSettings.getTableName(), null, null, null, null, null, null);
c.moveToLast();
DatabaseUtils.dumpCursor(c);
db.setTransactionSuccessful();
db.endTransaction();
here’s how i do my closing:
public void onPause() {
db.close();
}
public void onDestroy() {
db.close();
database.close();
}
public void onStop() {
db.close();
database.close();
}
public void onResume() {
db = database.getWritableDatabase();
}
after i restart the app it loses its contents.
Anyone got any ideas.
To preserve data after activity restart.Consider using following code snippet.
Please invest your time in reading
http://developer.android.com/guide/topics/fundamentals/activities.html#SavingActivityState
Hope this help.