RecyclerVIew onItemClickListener Not working

后端 未结 6 1241
一个人的身影
一个人的身影 2021-01-28 02:20

I am working on RecyclerView and try to using on click listener for each item of recyclcerview using Interface

Here is my Activity cla

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 03:22

    You this approach:

    @Override 
        public void onBindViewHolder(final ViewHolder holder, int position) {
            final String element = mDataset[position];
    
            holder.itemView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                   //your code 
                }
            });
        }
    

提交回复
热议问题