Having successfully produced a RecyclerView, and populated it with CardViews containing our data, we need to be able to select individual items and do something with them. Next, we will provide the RecyclerView with a click listener and add a new Activity that will present our records in greater detail on a separate screen.
Before we create our new Activity, we need an
OnClickListener that can tell which CardView was clicked on. Here's how it's done:
static View.OnClickListener mainOnClickListener;
onCreate()method like this:
mainOnClickListener = new MainOnClickListener(this);