user1870076
user1870076

Reputation: 77

DBFlow listen when query finish

Hello guys i've read the documentation of DBFlow - ORM android database library , but i was wondering what is the right way to listen when a query finish it's work. For example i've got insert and want to know if the insert is successful and when exactly finish.

DBFlow Library

Upvotes: 1

Views: 157

Answers (1)

Farhan
Farhan

Reputation: 13390

You need to use Transactions. and transactions when executed have 2 callbacks. success and error where you can do further processing. For example:

 transaction
    .success(new Transaction.Success() {
       @Override
       public void onSuccess(Transaction transaction) {
          // called post-execution on the UI thread.
       }
   })
   .error(new Transaction.Error() {
       @Override
       public void onError(Transaction transaction, Throwable error) {
          // call if any errors occur in the transaction.
       }
   });

Check following link for more details:

Storing data using DBFlow

Upvotes: 2

Related Questions