Android’s onClickListener by default provides the View that you clicked on. I created my own interface because I wanted to have access to the CardObject that was used to populate that particular item.

Hence its definition being

public void onCardTapped(CardObject cardObject);

so that when its implemented I could do something like

Toast.makeText(context,cardObject.getTitle(),Toast.LENGTH_LONG).show()

Thanks for the suggestion. Hope this helped

Software Engineer with great love for Mathematics especially Abstract Mathematics.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store