开发者

Switch and case option

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;  
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜