Freigeben über


SQLiteDatabase.BeginTransactionWithListenerReadOnly Method

Definition

Begins a transaction in read-only mode with a SQLiteTransactionListener listener.

[Android.Runtime.Register("beginTransactionWithListenerReadOnly", "(Landroid/database/sqlite/SQLiteTransactionListener;)V", "GetBeginTransactionWithListenerReadOnly_Landroid_database_sqlite_SQLiteTransactionListener_Handler", ApiSince=35)]
public virtual void BeginTransactionWithListenerReadOnly (Android.Database.Sqlite.ISQLiteTransactionListener? transactionListener);
[<Android.Runtime.Register("beginTransactionWithListenerReadOnly", "(Landroid/database/sqlite/SQLiteTransactionListener;)V", "GetBeginTransactionWithListenerReadOnly_Landroid_database_sqlite_SQLiteTransactionListener_Handler", ApiSince=35)>]
abstract member BeginTransactionWithListenerReadOnly : Android.Database.Sqlite.ISQLiteTransactionListener -> unit
override this.BeginTransactionWithListenerReadOnly : Android.Database.Sqlite.ISQLiteTransactionListener -> unit

Parameters

transactionListener
ISQLiteTransactionListener
Attributes

Remarks

Begins a transaction in read-only mode with a SQLiteTransactionListener listener. The database may not be updated inside a read-only transaction.

Transactions can be nested. However, the behavior of the transaction is not altered by nested transactions. A nested transaction may be any of the three transaction types but if the outermost type is read-only then nested transactions remain read-only, regardless of how they are started.

Here is the standard idiom for read-only transactions:

db.beginTransactionWightListenerReadOnly(listener);
              try {
                ...
              } finally {
                db.endTransaction();
              }

Java documentation for android.database.sqlite.SQLiteDatabase.beginTransactionWithListenerReadOnly(android.database.sqlite.SQLiteTransactionListener).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to