```private void runTimer() { final TextView timeV...
# getting-started
s
Copy code
private void runTimer() {
 final TextView timeView = (TextView)findViewById(R.id.time_view);
 final Handler handler = new Handler();
 <http://handler.post|handler.post>(new Runnable() {
 @Override
 public void run() {
 int hours = seconds/3600;
 int minutes = (seconds%3600)/60;
 int secs = seconds%60;
 String time = String.format(Locale.getDefault(),
 "%d:%02d:%02d", hours, minutes, secs);
 timeView.setText(time);
 if (running) {
 seconds++;
 }
 handler.postDelayed(this, 1000);
 }
 });
}