*TABLE NOT UPDATING*****HOW TO SOLVE THE PROBLEM
public String getElapsedTime(String session_id, String time) {
db = this.getWritableDatabase();
db.beginTransaction();
db.setTransactionSuccessful();
Log.d("CHINMAY", "Update in Sql get ElapsedTime " + session_id + "\n" + time);
ContentValues cv = new ContentValues();
cv.put(ELAPSED_TIME, time);
db.update(TABLE_SESSION_TEST, cv, "session_id=?", new String[]{session_id});
db.endTransaction();
return "Checking Update";
}
You need to mark your transaction as "clean" by calling db.setTransactionSuccessful()
before calling db.endTransaction()
. If you do not set your transaction as successful, your changes are immediately rolled back as soon as the transaction is ended (as it assumes there was an error).
For more information, see the SQLiteDatabase documentation here