Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Soma extends AppCompatActivity {
- TextView tempo;
- private int counter= 45;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_soma);
- tempo = (TextView) findViewById(R.id.tempo);
- new CountDownTimer(45000, 1000) {
- @Override
- public void onTick(long millisUntilFinished) {
- tempo.setText(String.valueOf(counter));
- counter--;
- }
- @Override
- public void onFinish() {
- tempo.setText("Acabou o tempo!");
- }
- };
Add Comment
Please, Sign In to add comment