48.9 Responding to Card Selections
The last phase of this project is to make the cards in the list selectable so that clicking on a card triggers an event within the app. For this example, the cards will be configured to present a message on the display when tapped by the user. To respond to clicks, the ViewHolder class needs to be modified to assign an onClickListener on each item view. Edit the RecyclerAdapter.java file and modify the ViewHolder class declaration so that it reads as follows:
.
.
import com.google.android.material.snackbar.Snackbar;
.
.
class ViewHolder extends RecyclerView.ViewHolder{
ImageView itemImage;
TextView itemTitle;
TextView itemDetail;
ViewHolder(View itemView) {
super(itemView);
itemImage = itemView.findViewById...