title: How can i make that in the timer my program will do something every second?
body: <p>In the top of MainActivity.java i added:</p>
  
  <pre><code>private Handler customHandler = new Handler();
  long timeSwapBuff = 0L;
  </code></pre>
  
  <p>Then inside the onCreate i did:</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          startTime = SystemClock.uptimeMillis();
  customHandler.postDelayed(updateTimerThread,0);
  
          timerValue = (TextView) findViewById(R.id.timerValue);
  
          startButton = (Button) findViewById(R.id.startButton);
  
          startButton.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View view) {
                  startTime = SystemClock.uptimeMillis();
                  customHandler.postDelayed(updateTimerThread, 0);
  
              }
          });
  
          pauseButton = (Button) findViewById(R.id.pauseButton);
          pauseButton.setOnClickListener(new View.OnClickListener() {
  
              public void onClick(View view) {
                  customHandler.removeCallbacks(updateTimerThread);
  
              }
          });
  </code></pre>
  
  <p>Then in the updateTimerThread:</p>
  
  <pre><code>private Runnable updateTimerThread = new Runnable() {
  
          public void run() {
  
              long updatedTime = 0L;
              long timeInMilliseconds = 0L;
              timeInMilliseconds = SystemClock.uptimeMillis() - startTime;//System.currentTimeMillis() - startTime;
              updatedTime = timeSwapBuff + timeInMilliseconds;
  
              int secs = (int) (updatedTime / 1000);
              int mins = secs / 60;
              secs = secs % 60;
              int milliseconds = (int) (updatedTime % 1000);
              timerValue.setText("" + mins + ":"
                      + String.format("%02d", secs) + ":"
                      + String.format("%03d", milliseconds));
              customHandler.postDelayed(this, 0);
          }
  
      };
  </code></pre>
  
  <p>Now each time i run my program from the start the timer will start from 00:00:00</p>
  
  <p>Now i want to add somehow something that each second to do something.
  Not to reset the timer not to pause or stop it to let it keep running but each second i want to do something else in my program.</p>
  
  <p>The problem is how do i check every second to do something ?</p>