Problem is, in CountDownTimer.java (Android source code) it creates a mHandler inside the code which makes the caller should call the CountDownTimer class on UI thread which is not possible in my case. So I created a separate Timer class,
Timer cTimer = new Timer();
private final static int START_FROM = 60;
cTimer.scheduleAtFixedRate(new TimerTask() {
int i = START_FROM ;
public void run() {
Log.d(TAG, "Comparison will start in:" + i--);
if (i< 0) {
cTimer.cancel();
// Do something
}
}
}, 0, 1000);