开发者

Switch and case option

开发者 https://www.devze.com 2023-01-15 11:59 出处:网络
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

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

精彩评论

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