Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Crash when getting the ViewHolder class of a ViewCell that extends a non-generic ViewCell #4

Open
gantonious opened this issue Nov 27, 2016 · 0 comments
Labels

Comments

@gantonious
Copy link
Owner

gantonious commented Nov 27, 2016

How to recreate:

public class ParentViewCell extends GenericSingleViewCell<ParentViewCell.ViewHolder, Model> { ... }
public class ChildViewCell extends ParentViewCell { ... }

When getViewHolderClass() is called in the ChildViewCell an ArrayIndexOutOfBoundsException will be thrown when trying to access the parametrized type.

The current workaround is to override the getViewHolderClass() method in the subclass:

public class ChildViewCell extends ParentViewCell {
    @Override
    public Class<? extends ViewHolder> getViewHolderClass(int position) {
        return ParentViewCell.ViewHolder.class;
    }
}
@gantonious gantonious added the bug label Nov 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant