Open RuslanPrimak opened 7 years ago
If you delete the object then you're supposed to synchronize the ExpendableListAdapter's contents by listening to the results with a RealmChangeListener
(i'm not sure if RealmBaseAdapter handles ExpendableListAdapter, because I haven't used that thing in a long long time)
Source code of test project can be found here: https://github.com/RuslanPrimak/RealmAdapterExpandableList
@RuslanPrimak I relabel the issue as I think we should call isValid()
in equals()
.
Feature Request
Goal
Simply use
if (object1.equals(object2))
instead ofif ((object2 != null) && object2.isValid() && object1.equals(object2))
Expected Results
Correct behavior of an app
Actual Results
App crashes without any error message in logcat
Steps & Code to Reproduce
I use ExpandableListView with custom adapter derived from BaseExpandableListAdapter. In order to provide group and child selection indicator I keep a reference in adapter to selected RealmObject and use condition
group.equals(mSelected)
where group and mSelected the instances of the same class derived from RealmObject.When I delete the selected object from Realm then mSelected become invalid and equals crashes the app.
Version of Realm and tooling
Realm version(s): 3.1.3
Realm sync feature enabled: no
Android Studio version: Android Studio 2.3.1 Build #AI-162.3871768, built on April 1, 2017 JRE: 1.8.0_112-release-b06 amd64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Which Android version and device: any