複数の行を更新したい。make status=false where status=true および make status=true where id=x のように
try {
String where = "id=?";
String[] whereArgs = new String[] { Id };
SQLiteDatabase db = this.getWritableDatabase();
ContentValues initialValues = new ContentValues();
initialValues.put("status", "true");
db.update(TABLE_PROJECT, initialValues, where, whereArgs);
db.close();
} catch (Exception e) {
Log.e("Exception in update query", e.toString());
}
現在、最初にステータスを更新できますが、次回になると、以前のステータスを false に変更してから、新しいステータスを true に更新する必要があります。検索したところ、スイッチケースで実行できることがわかりましたが、これをどのように適用できますか?