RecyclerVIew onItemClickListener Not working

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

    Your interface adapter class should be like this

    public class LegacyModeHomeAdapter extends RecyclerView.Adapter {
        private List

    And your adapter usage class should be like this

    adapter.setOnItemClickListener(new LegacyModeHomeAdapter.LegacyVideoClickListener() {
            @Override
            public void onItemClick(int position, View v) {
                //Your code
            }
        });
    

    Using this way of interface settings you can achieve the onclick listener function exactly. Please let me know if you are having trouble still.

提交回复
热议问题