Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.android.courtcounter;
- import android.os.ParcelUuid;
- import android.support.v7.app.AppCompatActivity;
- import android.os.Bundle;
- import android.view.View;
- import android.widget.TextView;
- public class MainActivity extends AppCompatActivity {
- int scoreTeamA = 0;
- int scoreTeamB = 0;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- displayForTeamA(0);
- }
- //This method is called when the order button is clicked.
- public void resetea(View view) {
- scoreTeamA = 0;
- scoreTeamB = 0;
- displayForTeamA(scoreTeamA);
- displayForTeamB(scoreTeamB);
- }
- //This method is called when the order button is clicked.
- public void SumaTresTeamA(View view) {
- scoreTeamA= scoreTeamA+ 3;
- displayForTeamA(scoreTeamA);
- }
- //This method is called when the order button is clicked.
- public void SumaDosTeamA(View view) {
- scoreTeamA= scoreTeamA+ 2;
- displayForTeamA(scoreTeamA);
- }
- public void SumaUnoTeamA(View view) {
- scoreTeamA= scoreTeamA+ 1;
- displayForTeamA(scoreTeamA);
- }
- // Suma uno para el scoreTeamB
- public void SumaTresTeamB(View view){
- scoreTeamB = scoreTeamB + 3;
- displayForTeamB(scoreTeamB);
- }
- // Suma uno para el scoreTeamB
- public void SumaDosTeamB(View view){
- scoreTeamB = scoreTeamB + 2;
- displayForTeamB(scoreTeamB);
- }
- // Suma uno para el scoreTeamB
- public void SumaUnoTeamB(View view){
- scoreTeamB = scoreTeamB + 1;
- displayForTeamB(scoreTeamB);
- }
- // * Displays the given scoreTeamAfor Team A.
- public void displayForTeamA(int score) {
- TextView scoreView = (TextView) findViewById(R.id.team_a_score);
- scoreView.setText(String.valueOf(score));
- }
- // * Displays the given scoreTeamAfor Team B.
- public void displayForTeamB(int score) {
- TextView scoreView = (TextView) findViewById(R.id.team_b_score);
- scoreView.setText(String.valueOf(score));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement