I have a recycler view item that has few Views. I have a setting that will set the visibility of one Image view after the Recycler view is displayed. What is the best way to achieve this behavior?
What I tried, in the adapter ViewHolder class, I set a boolean that would hide the element and then call notifysetDataChanged()
public static class ViewHolder extends RecyclerView.ViewHolder {
public ImageView imageView;
public ViewHolder(View itemView) {
super(itemView);
.....
}
public void bind(item: Model){
//check and set visibility
if(showImage) imageview.setVisibility
else imageview.setVisibility
}
}
Calling this bind function from onBindViewHolder.
Is there any better way to achieve this as all the data remain the same only one visibility is changed?
