Hey. There was a question ... How to update only one field in the SQLite table - Android. Update the whole entry too much excess code ...

  • add condition to update to select this record? - KoVadim
  • Sorry, I thought and wrote "record", I need to update only one field in the record. Yes, how to make the condition correctly? I update the whole record like this: - db.update ("mytable", cv, "id =?", New String [] {id}); "cv" contains data for all fields as pairs (column name is value) .... This approach is not suitable for updating only 1 field ... - Oneills
  • In ContentValues, you only need to add a value for one field. - Lucky_spirit

1 answer 1

eg:

String sql = "update mytable set sended = 1 where _id =" + recordid + ";" ; db.execSQL(sql);