RealmResults对象获得恒定的NPE

时间:2018-08-02 08:48:46

标签: android realm

我收到一个错误:Unable to destroy activity: java.lang.NullPointerException: Attempt to invoke virtual method 'void io.realm.RealmResults.removeAllChangeListeners()' on a null object reference

代码:

@Override
protected void onDestroy() {
    if (realmResult != null) {
        realmResult.removeAllChangeListeners();
    }
    mRealm.close();
    super.onDestroy();
}

我仍然有NPE。在致电removeAllChangeListeners()之前,我还应该检查一些其他东西吗?

0 个答案:

没有答案