Jerin Raj
Jerin Raj

Reputation: 387

How to access an item from a Recyclerview in Android?

How to access an item from a RECYCLERVIEW ?

(I am using the following statement to access an item from listview : listview.getChildAt(position).findViewById(R.id.txtView).setVisibility(View.VISIBLE); ) .

Upvotes: 1

Views: 1079

Answers (1)

Anoop M Maddasseri
Anoop M Maddasseri

Reputation: 10529

For example consider the below class as your ViewHolder

class ViewHolder extends RecyclerView.ViewHolder {

        public ImageView imgThumbnail;
        public ImageView imgProfIcon;
        public TextView tvspecies;
}

You can access it from onBindViewHolder

@Override
    public void onBindViewHolder(ViewHolder viewHolder, int i) {
        viewHolder.tvspecies.setText("Recycler View");
}

Upvotes: 1

Related Questions