Home > Back-end >  Set an on click listener on button in a fragment in the main activity file
Set an on click listener on button in a fragment in the main activity file

Time:03-03

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.

CodePudding user response:

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

CodePudding user response:

you can use interface for this problem

  • Related