Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Timer;
import java.util.TimerTask;

import android.os.Handler;

public class Main {
    public static Timer setTimeOut(final Runnable runnable, int delayMillis) {
        final Handler handler = new Handler();
        final Timer timer = new Timer();
        timer.schedule(new TimerTask() {

            @Override
            public void run() {
                handler.post(runnable);
                timer.cancel();
            }
        }, delayMillis);
        return timer;
    }
}