answersLogoWhite

0

To create a timer you might try the java.util.Timer class.

Check out the following methods:

void schedule(TimerTask task, long delay, long period)

Schedules the specified task for repeated fixed-delay execution, beginning after the specified delay.

void scheduleAtFixedRate(TimerTask task, long delay, long period)

Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.

If you just want a one-time event you can still use a Timer instance and schedule a single TimerTask or just create a new Thread with anonymous Runnable class that sleeps for 3 minutes before doing something.

new Thread(new Runnable() {

public void run() {

try {

Thread.sleep(TimeUnit.MINUTES.toMillis(3));

// do stuff here

} catch (InterruptedException e) {

// handle interruption

}

}

}).start();

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

How long is the timer in Pictionary"?

The timer in Pictionary is typically set for one minute.


How can one set up the timer on the Canon Powershot A470?

One can set up the timer on the Canon Powershot A470 by opening the user's manual, checking the index and finding the page that explains how to set up the timer. Follow the instructions on that page.


How do you set timer on clearwater LM2 zodiac pool chlorinator?

set timer zodiac lm2


How can I set up a timer for lights in my home?

To set up a timer for lights in your home, you can purchase a plug-in timer device from a hardware store. Simply plug the timer into the outlet, then plug your lights into the timer. Set the timer according to your desired schedule, and the lights will turn on and off automatically at the designated times.


How is a computer off timer set?

with a home lamp timer


How can I set a timer for outdoor lights?

To set a timer for outdoor lights, you can use a programmable timer switch. First, plug the lights into the timer switch, then set the desired on and off times using the timer's controls. Make sure to follow the manufacturer's instructions for proper setup and programming.


How can I set a timer for a light switch?

To set a timer for a light switch, you can install a timer switch that allows you to program when the light turns on and off. Simply follow the instructions provided with the timer switch to set the desired time intervals for the light to operate.


Define set in java?

A Java set is a collection of things that do not contain duplicate elements. Duplicates are prohibited from Java sets.


How can I set up a programmable light timer for my home lighting system?

To set up a programmable light timer for your home lighting system, follow these steps: Plug the programmable light timer into an electrical outlet. Set the current time on the timer according to the instructions provided. Program the timer to turn the lights on and off at specific times using the timer's settings. Plug your lights into the timer's outlets. Test the timer to ensure it is working correctly. By following these steps, you can easily set up a programmable light timer for your home lighting system.


How do you set timer?

You need to turn the timer handle hars in a clockwise motion


Where can i find an online 10 second timer?

I do not think that u can find a useful 10 second online timer. I am not sure what you would like to time, but just the request to a server will porbably take more than 10 seconds. You can maybe use a client side timer, that is, one that runs a program on your own computer, just a java script timer that runs on you web browser . That may be ok, but directly to look at a server side timer, software that runs on a remote web site, is not a good solution. Hard to say what you need the timer for. There are some java script links below that may be helpful. If you give more details about the application of the timer, maybe i can help you


Can this be set to come on and off with a timer when I am gone?

Yes, this television can be set to turn on and off using the timer function. Just set the time in the menu.