回答

0
public class MyAdapter extends RecyclerView.Adapter<MyAdapter.MyViewHolder>{ 
.... 
public ArrayList<MyItem> dataItems; 

class MyViewHolder extends RecyclerView.ViewHolder{ 

    public MyViewHolder(View itemView, Context context) { 
     super(itemView); 
     .... 
     itemView.setOnClickListener(new View.OnClickListener(){ 
      @Override 
      public void onClick(View v) { 
       // get position 
       int pos = getAdapterPosition(); 

       // check if item still exists 
       if(pos != RecyclerView.NO_POSITION){ 
        MyItem clickedDataItem = dataItems.get(pos); 
        // here call your callback's method, or notify using other way 
       } 
      } 
     }); 
    } 
} 
+0

感謝,但工作一個項目,我想獲得活動@Andrew Scyter –

+0

我想在命令按鈕上點擊所有項目值,你應該在所有的活動項目的列表。如果加載數據邏輯是在適配器本身,我想,你可以添加一個回調這樣的數據活動,當加載完成 –

+0

如何添加回調? @Andrew Scyter –