Toast.makeText(this@YOUR_ACTIVITY_NAME, "Clicked on " + users.get(position).name, Toast.LENGTH_LONG).show()
Here is what the above code is Doing:
1. We are creating a new object of the User class and passing the name and image to it.
2. We are adding the object to the ArrayList.
3. We are calling the notifyDataSetChanged() method of the adapter to notify the adapter that the data has been changed.
4. We are setting the adapter to the RecyclerView.
5. We are setting the layout manager to the RecyclerView.
6. We are setting the onItemClickListener to the RecyclerView.