I have a RecyclerView in my app that displays a row containing pictures and photographs downloaded from the internet. There is a photo and a button on screen. When the user clicks a button, I want to make another view visible on top of the on screen photo.
I have a CustomViewHolder that holds all the views for the RecyclerView and a CustomRecyclerViewAdapter that displays the viewholder views. The onClick method for the button is overridden in the CustomViewHolder as below -
public static class CustomViewHolder extends RecyclerView.ViewHolder
implements OnClickListener {
public Button mButton;
public ImageView mImageView1;
public ImageView mImageView2;
public CustomViewHolder(View v)
{
super(v);
mButton = (Button) ... // Initializing views
mImageView1 = (ImageView) ...
mImageView2 = (ImageView) ...
}
@Override
public void onClick(View v) {
int id = v.getId();
if(id == R.id.buttonid)
{
// TODO mImageView2.setVisibility(View.VISIBLE);
// Any ideas on how to get the mImageView2 of this same item so it can be made visible?
}
}
I need a way to get a reference of the mImageView2 view at the same position as the clicked button. Does anybody know how to do this? I'd really appreciate any help.