-
Notifications
You must be signed in to change notification settings - Fork 127
Closed
Description
RecyclerView always calls the adapter with position
within a data set bounds, so that when a data set is empty getItemViewType
and onBindViewHolder
won't be called.
According to the source code INameableAdapter
could be called even if the list is empty, while the doc has nothing about this behaviour. Actually even the demo application is crashing if activity.getPackageManager().getInstalledApplications
(AppData.java:AppData.processApps) returns an empty list, making testAdapter
to try to reach a first element of empty list leading to OOB exception.
So I see two ways to solve this:
- make it clear that
INameableAdapter.getCharacterForElement
could be called with invalid index - don't call this method when the list is empty
Metadata
Metadata
Assignees
Labels
No labels