Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final EditText editText = (EditText) findViewById(R.id.editText1);
- Timer timer = new Timer();
- timer.scheduleAtFixedRate(new TimerTask() {
- @Override
- public void run() {
- Calendar c = Calendar.getInstance();
- int seconds = c.get(Calendar.SECOND);
- final String time = String.valueOf(seconds);
- runOnUiThread(new Runnable() {
- @Override
- public void run() {
- editText.setText(time);
- if (time.equals("30")) {
- finish();
- }
- }
- });
- }
- }, 0, 1000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement