Last active
July 29, 2016 00:43
-
-
Save ericlucero/75a1a022591ddff2fc778b8b2e9ef4f6 to your computer and use it in GitHub Desktop.
Contador de Puntos para BasketBall
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment