【问题标题】:DBFlow listen when query finish查询完成时 DBFlow 侦听
【发布时间】:2016-02-02 15:18:52
【问题描述】:

大家好,我已经阅读了 DBFlow - ORM android 数据库库的文档,但我想知道当查询完成时正确的监听方式是什么。 例如我有插入,想知道插入是否成功以及何时完成。

DBFlow Library

【问题讨论】:

    标签: android orm dbflow


    【解决方案1】:

    您需要使用 Transactions。执行时的事务有 2 个回调。 successerror 可以进行进一步处理。 例如:

     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.
           }
       });
    

    查看以下链接了解更多详情:

    Storing data using DBFlow

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 2020-06-06
      • 2013-04-23
      • 2020-01-24
      • 2021-08-07
      • 1970-01-01
      相关资源
      最近更新 更多