Custom Timer Example in Android
Hello Friends,. Today I am going to share important code for countdown watch in Android. For this I am using Handler Thread. Hope it will help you guys. Just copy paste below code and enjoy. 1. TimerActivity.java package com.pack.counttimer; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.SystemClock; import android.view.View; import android.widget.Button; import android.widget.TextView; public class TimerActivity extends Activity { private TextView textTimer; private Button startButton; private Button pauseButton; private long startTime = 0L; private Handler myHandler = new Handler(); long timeInMillies = 0L; long timeSwap = 0L; long finalTime = 0L; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_timer); textTimer = (TextView) findViewById(R.id.textTimer); startButton =