topxebec
topxebec

Reputation: 1427

Onclick in xml by include

In my project,I user onclick directly in the xml to assign a onclick methond to a button,it worked in my activityA, but when i have an activityB which setcontentview with a xml using the xml which contains the "onclick" and add the same onclick function in my activityB,it does not work in the activityB.

What should I do to make it work? Maybe find the button using findviewbyid and asign a new onclick to it work,but is there a more direct way to do this?

Upvotes: 0

Views: 453

Answers (1)

bakriOnFire
bakriOnFire

Reputation: 2681

the onClick of activityA will not work for the button clicked in activityB..you'll have to again write the code of onClick in activityB..

Upvotes: 1

Related Questions