I have an activity with 5 buttons. I want to use the switc开发者_运维技巧h option. How can I detect which button is clicked?
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;
}
精彩评论