RecyclerVIew onItemClickListener Not working

后端 未结 6 1247
一个人的身影
一个人的身影 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:08

        class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
    
            public Button btMyButton;
    
            public ViewHolder(View itemView) {
                super(itemView);
                itemView.setOnClickListener(this);
            }
    
            @Override
            public void onClick(View v) {
                   // your implementation. In order to get position you can use `getAdapterPosition()` method               
           }
        }
    

提交回复
热议问题