• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Firing diffrent listener

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.
 
Back
Top Bottom