How to get item from RecyclerView adapter in Android

后端 未结 5 1120
情歌与酒
情歌与酒 2021-02-01 12:37

In old code when I was using ListView with custom adapter I could get item with this code.

Message msg = (Message) adapter.getItem(poistion);
         


        
5条回答
  •  猫巷女王i
    2021-02-01 13:09

    @Override public void onClick(View view, int position) {
    
    System.out.println("cardetail_activity"+position);
     Intent i = new Intent(getActivity(), CarDetail.class); 
    ListingDataprovider data_provider=arrayList.get(position); i.putExtra("ID",data_provider.getId()); getActivity().startActivity(i);
    
    }
    

提交回复
热议问题