public void payment() {
SQLiteDatabase db = ();
db.beginTransaction();//Start a transaction
try {
("update person set amount=amount-10 where personid=2");
("update person set amount=amount+10 where personid=5");
db.setTransactionSuccessful();// Set the transaction flag to true. Calling this method will submit the transaction when the endTransaction() method is executed. If this method is not called, the transaction will be rolled back when the endTransaction() method is executed.
} catch (SQLException e) {
} finally {
db.endTransaction();
}
// There are two situations when ending a transaction: commit, rollback,
// The commit or rollback of a transaction is determined by the transaction's flag. If the transaction's flag is true, it will be committed. Otherwise, rollback will be rolled back. By default, the transaction's flag is false.
}