expandable-recycler-view
expandable-recycler-view copied to clipboard
Issue in View type
In Child view type when i define some view type with value 0,1 the application crashed with this exception
: java.lang.ClassCastException: ....$DeParentHolder cannot be cast to com.bignerdranch.expandablerecyclerview.ChildViewHolder
because parent and child view holder have constant values for view type, So when i change my child view type values from 0,1 to 100 and 200 the application work successfully without any issue
@ahmedsalemelzeiny I also had the same issue, and I guess we can attribute it to bad documentation since clearly view types 0 and 1 are reserved for categories and children.
I've already tried to document this in both methods of getParentViewType
here and getChildViewType
here which I assumed would be read before overriding. Is there a better place to put this information? Looks like I should add a note in our page as well since it isn't mentioned there, any others?
I don't think changing the values will help much since that might make it less obvious that we are using them for the defaults (making the crash seem more random).
@paul-turner Much better if it is in the page since it is where devs look for quick references. For example, I stumbled upon the issue because I tried to have 2 types of parent (I needed another view type which is not supposed to be the same object as a parent or a child) while only having a single child and since it was not explicitly stated in the site, I stupidly assumed that after the isParentViewType()
override is defined, the child viewType
would be automatically adjusted.
wasted one hour trying to figure out what causes this issue:(