beginTransaction() //Begins a transaction in EXCLUSIVE mode. endTransaction() //End a transaction. 

What does a transaction in SQLiteDatabase in exclusive mode (EXCLUSIVE mode) and in what case do these methods apply? Is it enough just to close the database using db.close() ?

    1 answer 1

    A transaction is (conditionally) working with data on the "all or nothing" principle. If at any stage of the transaction fails, all previous changes should be reversed.

    In SQLite transactions have 3 lock modes. Of these, EXCLUSIVE (monopoly) is the highest. In this case, the database is blocked entirely and until the transaction is completed other transactions cannot even read the data from it.

    More details can be found here and here .

    Is it enough just to close the database using db.close ()?

    Not. The transaction (especially exclusive) must be completed with the endTransaction method.