Code example for ScheduledThreadPoolExecutor

Methods: schedule

0
    public void setTestTimer(final int stepIndex, int delay) {
        cancelTimerTask(); 
 
        mIndex = stepIndex;
 
        mTimerTask = new ScheduledThreadPoolExecutor(10);
        mTimerTask.schedule(this, delay, TimeUnit.MILLISECONDS);
    } 
 
    public void setTestTimer(final int stepIndex) {
        setTestTimer(stepIndex, 0);
    } 
 
    @Override 
    public void run() { 
        Message message = mHandler.obtainMessage();
        message.arg1 = mIndex;
        mHandler.sendMessage(message);
    } 
 
    public void cancelTimerTask() {