I have tried to do some research on the topic and I am attempting to add an on-click listener for a button in a fragment in the main activity. So when I click a button in a fragment the click can get registered in the main activity file.
Question posted in Android Studio
The official documentation can be found here.
The official documentation can be found here.
2
Answers
You can use custom broadcast receiver
You will register a receiver on button click in fragment
Then in activity apply action if this broadcast action equal to this custom action
you can use interface for this problem