Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
481
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. public void plus3(View v) {
  2. switch (v.getId()) {
  3. case R.id.button:
  4. TextView score = (TextView) findViewById(R.id.textView3);
  5. String s = score.toString();
  6. int x = Integer.parseInt(s);
  7. x += 3;
  8. score.setText("" + x);
  9. break;
  10. case R.id.button2:
  11. TextView scoreB = (TextView) findViewById(R.id.textView4);
  12. String sB = scoreB.toString();
  13. int xB = Integer.parseInt(sB);
  14. xB += 3;
  15. scoreB.setText("" + xB);
  16. break;
  17. }
  18. }
  19. }
  20.  
  21. //Вызов в вью кнопки:
  22. android:onClick="plus3"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement