skip to Main Content

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.

2

Answers


  1. 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

    Login or Signup to reply.
  2. you can use interface for this problem

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search