I got a parent layout
activity_main.xml layout with multiple views inside it, one of which is the
What happens is that, within the recycler view, there are buttons that, once the user deals with, I would like things to happen in the parent layout that is
For example, if I press a button on a
ViewHolder item inside the child
RecyclerView, in some cases, I would like changes to happen in the parent
However, my problem is that I don’t know how to allow for this communication to happen.
Any suggestions on what might be the best practices for such cases?
You need to create Interface callback or use higher order function.
This link is an example of interface callback
How to access component of MainActivity in recycler view to make onclick listener?
This link is for higher order function https://www.geeksforgeeks.org/kotlin-lambda-functions-for-recyclerview-adapter-callbacks-in-android/
Answered By – Ashutosh Ojha
Answer Checked By – Dawn Plyler (Easybugfix Volunteer)