Referring to Jacob Tabok's post here, I added an OnItemTouchListener to my Fragment's onCreateView here:
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recyclerview, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.list_recylclerview);
mRecyclerView.setLayoutManager(new LinearLayoutManager(_context));
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
mRecyclerView.addOnItemTouchListener(
new RecyclerItemClickListener(_context, new RecyclerItemClickListener.OnItemClickListener() {
@Override public void onItemClick(View view, int position) {
logger.i("onitemClick");
}
})
);
I have absolutely no idea how to determine which button within my cardview was clicked using the suggested practice. The problem is the whole cardview is returned instead of the item I click as shown in here.
How can I determine which button was clicked? I'd like to avoid the viewholder suggestion in this post as I'm am doing lots of fragment transactions