Make one listener class implementing OnClickListener and set this listener to all buttons and then in OnClick(View v) implement all logic performed on click event.
you can get reference of resource id of button by
v.getId()
then compare it to all buttons
if(v.getId()==R.id.button1)
then write logic which you want to perform when button1 is clicked.
make sure all buttons have different ids by layout xml.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.