Reputation: 1
I have an activity with 5 buttons. I want to use the switch option. How can I detect which button is clicked?
Upvotes: 0
Views: 327
Reputation: 5496
Here is a guide: http://developer.android.com/guide/topics/ui/ui-events.html
Inside onClick(View v):
switch(v.getId()){
case R.id.nameofbutton:
//do this
break;
}
Upvotes: 2