You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello.
Is there any way to support different viewTypes that doesn't extends Model like AdExpressViewHolder ?
The problem is that in your implementation onCreateViewHolder must return something that extend Model class ViewHolder<? extends ExampleModel> onCreateViewHolder
Is it possible in my situation ?
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
final View v = inflater.inflate(viewType, parent, false);
if (viewType == VIEW_TYPE_COLLAPSED) {
return new CollapsedVH(v, this);
} else if (viewType == VIEW_TYPE_EXPANDED) {
return new ExpandedVH(v, this);
} else if (viewType == VIEW_TYPE_AD_EXPRESS) {
return new AdExpressViewHolder(v);
} else return null;
}
The text was updated successfully, but these errors were encountered:
Hi! At the moment this is not possible. The Adapter has to enforce that type constraint to allow for the simplified binding functionality. However there are ways to still have the simplified binding feature and allow for any type of ViewHolder to be used. I am going to look into this at some point in the near future. In the meantime this issue is going to stay open until I either implemented this change or decided not to implement it at all.
Hello.
Is there any way to support different viewTypes that doesn't extends Model like AdExpressViewHolder ?
The problem is that in your implementation onCreateViewHolder must return something that extend Model class
ViewHolder<? extends ExampleModel> onCreateViewHolder
Is it possible in my situation ?
The text was updated successfully, but these errors were encountered: