Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. package com.example.android.courtcounter;
  2.  
  3. import android.os.ParcelUuid;
  4. import android.support.v7.app.AppCompatActivity;
  5. import android.os.Bundle;
  6. import android.view.View;
  7. import android.widget.TextView;
  8.  
  9. public class MainActivity extends AppCompatActivity {
  10. int scoreTeamA = 0;
  11. int scoreTeamB = 0;
  12. @Override
  13. protected void onCreate(Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. setContentView(R.layout.activity_main);
  16. displayForTeamA(0);
  17. }
  18. //This method is called when the order button is clicked.
  19. public void resetea(View view) {
  20. scoreTeamA = 0;
  21. scoreTeamB = 0;
  22. displayForTeamA(scoreTeamA);
  23. displayForTeamB(scoreTeamB);
  24. }
  25. //This method is called when the order button is clicked.
  26. public void SumaTresTeamA(View view) {
  27. scoreTeamA= scoreTeamA+ 3;
  28. displayForTeamA(scoreTeamA);
  29. }
  30. //This method is called when the order button is clicked.
  31. public void SumaDosTeamA(View view) {
  32. scoreTeamA= scoreTeamA+ 2;
  33. displayForTeamA(scoreTeamA);
  34. }
  35. public void SumaUnoTeamA(View view) {
  36. scoreTeamA= scoreTeamA+ 1;
  37. displayForTeamA(scoreTeamA);
  38. }
  39. // Suma uno para el scoreTeamB
  40. public void SumaTresTeamB(View view){
  41. scoreTeamB = scoreTeamB + 3;
  42. displayForTeamB(scoreTeamB);
  43. }
  44. // Suma uno para el scoreTeamB
  45. public void SumaDosTeamB(View view){
  46. scoreTeamB = scoreTeamB + 2;
  47. displayForTeamB(scoreTeamB);
  48. }
  49. // Suma uno para el scoreTeamB
  50. public void SumaUnoTeamB(View view){
  51. scoreTeamB = scoreTeamB + 1;
  52. displayForTeamB(scoreTeamB);
  53. }
  54. // * Displays the given scoreTeamAfor Team A.
  55. public void displayForTeamA(int score) {
  56. TextView scoreView = (TextView) findViewById(R.id.team_a_score);
  57. scoreView.setText(String.valueOf(score));
  58. }
  59. // * Displays the given scoreTeamAfor Team B.
  60. public void displayForTeamB(int score) {
  61. TextView scoreView = (TextView) findViewById(R.id.team_b_score);
  62. scoreView.setText(String.valueOf(score));
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement