Guest User

Untitled

a guest
Oct 19th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. btn_other.setOnClickListener(this);
  2.  
  3. <Button ...
  4. android:id="+@id/landButton
  5. android:onClick = "onClick"/>
  6.  
  7. public void onClick(View view){
  8. switch (view.getId()){
  9. case R.id.landButton: //нажали на кнопку landButtin;
  10. break;
  11. }
  12. }
  13.  
  14. Button landButton = (Button) findViewById(R.id.landButton);
  15. if (landButton != null) {
  16. // действия с кнопкой
  17. }
  18.  
  19. @OnClick(R.id.myButton)
  20. public void onClickMyButton(View view) {
  21. //blah-blah
  22. }
  23.  
  24. @Optional
  25. @OnClick(R.id.myButton)
  26. public void onClickMyButton(View view) {
  27. //blah-blah
  28. }
Add Comment
Please, Sign In to add comment