I need to keep data from checkboxes in database.
Is there an easy way to change value of row i to 1 and values of all other rows to 0? Or I have to iterate over all rows? I also sow such solution:
ContentValues values = new ContentValues();
values.put(DragViewSyncTable.COLUMN_PLAYER_PREPARED, 0);
context.getContentResolver()
.update(DragViewSyncContentProvider.CONTENT_URI, values, null, null);
values = new ContentValues();
values.put(DragViewSyncTable.COLUMN_PLAYER_PREPARED, 1);
context.getContentResolver()
.update(DragViewSyncContentProvider.CONTENT_URI, values, DragViewSyncTable.COLUMN_ID + " =? ", new String[]{""+i});
Aucun commentaire:
Enregistrer un commentaire