0

For example,

Assume that I have 2 buttons with the same ID in two different fragment layouts.

layout1 - myButtonAction layout2 - myButtonAction

In the parent activity if I do this:

@OnClick(R.id.myButtonAction)
public void doSomething() {
   // Only the button in first layout works
}

Any suggestions regarding this?

Thanks

trancer
  • 135
  • 1
  • 7
  • Why not bind the click event within the fragment's code? If you need to do something at the activity level you can implement a callbacks pattern. – Dan Harms Apr 22 '16 at 20:27
  • The onclick does the same thing, I'm trying to reuse the code – trancer Apr 22 '16 at 20:32

0 Answers0