ListView: [Android] Null Reference Exception when using Range Collection and ListView is initially grouped
Null Reference Exception is thrown when the ListView is initially grouped with more than 1 group descriptor and then the control is populated using Range Observable collection.
2 comments
n/a
Posted on:11 Apr 2022 14:53
Hello -
This does not work for us. Applying the grouping after populating is not possible. Data is being added to the list by RFID scanning asynchronously. Imaging we get 5 new tags of data, we have to ungroup the list, add the items, then regroup it. Then 5 more items may come thru in the next second, etc. This also prevents using the normal ObservableCollection for same reason. Adding 5 times to the collection would raise the change even 5 times instead of 1 time using the RangeObservableCollection. INotifyCollectionChanged supports multiple items being manipulated at once (eg, multiple add or remove) so this control should also support multiple changes.
Thanks,
ADMIN
Didi
Posted on:11 Apr 2022 14:47
Workaround:
Approach 1) Apply grouping after populating the ListView with Items
Approach 2) Replace ObservableRangeCollection with ObservableCollection(only if the usage of range collection is not mandatory).