letz
letz

Reputation: 1792

Listen all buttons events Android

Its possible to have a listener to all buttons without setting the onClickListener in each button across all activities? and without making a extends button with the listener already set.

Upvotes: 0

Views: 177

Answers (2)

TechnoBlahble
TechnoBlahble

Reputation: 633

If all the buttons are doing the exact same thing, you can include that in the List kind of a layout and have one button with just one onCLick() event

Upvotes: 0

Gabe Sechan
Gabe Sechan

Reputation: 93559

No. Each view has to be told what to listen to. You can specify it in xml if you prefer with the onClick attribute, but you'll still need to specify it on each object.

Upvotes: 3

Related Questions