Check out example codes for "android timer". It will help you in understanding the concepts better.

Code Example 1

private int counter;

TimerTask timerTask = new TimerTask() {
	@Override
	public void run() {
		Log.e("TimerTask", String.valueOf(counter));
		counter++;
	}
};

Timer timer = new Timer();
timer.schedule(timerTask, 0, 1000);

Learn ReactJs, React Native from akashmittal.com