Guest User

Untitled

a guest
Jun 24th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public class Soma extends AppCompatActivity {
  2. TextView tempo;
  3. private int counter= 45;
  4.  
  5. @Override
  6. protected void onCreate(Bundle savedInstanceState) {
  7. super.onCreate(savedInstanceState);
  8. setContentView(R.layout.activity_soma);
  9. tempo = (TextView) findViewById(R.id.tempo);
  10. new CountDownTimer(45000, 1000) {
  11. @Override
  12.  
  13. public void onTick(long millisUntilFinished) {
  14. tempo.setText(String.valueOf(counter));
  15. counter--;
  16. }
  17.  
  18. @Override
  19. public void onFinish() {
  20. tempo.setText("Acabou o tempo!");
  21. }
  22. };
Add Comment
Please, Sign In to add comment