我收到一个错误: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()
之前,我还应该检查一些其他东西吗?