This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java Micro Edition and the fly likes Need Help with Timer Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Need Help with Timer Class" Watch "Need Help with Timer Class" New topic
Author

Need Help with Timer Class

Michael Hubele
Ranch Hand

Joined: Dec 17, 2005
Posts: 182
Hi

I have a assignment where I have to make a scheduler that when you add a task and a time when the time runs out it should show that scheduled task no matter what your doing.

So I figured out how to do most of it expect one thing.

Say if you add these tasks:

Task: my first task
Time(in seconds): 10

Task: my second task
Time(in seconds): 2

now Task2 will go before Task1(unless your really slow and took 10 seconds to add task2).

Now how I have it right now when the TimerTask happens it takes whatever is in the Task field and displays it.

This of course is not what should be happening since what will happen is when I write "my second task" and add that to the schedule and the 2 seconds go by it will display "my second task" but when "my first task" comes along it won't display "my first task" instead it will display "my second task" or any thing what is written in the Task textbox at that given time.

I have no way of actually storing the tasks. The problem is I don't know how to store the tasks so they go in order.

How would I store them and then make sure the right task gets called up at the right time?

Thanks
 
jQuery in Action, 2nd edition
 
subject: Need Help with Timer Class
 
Similar Threads
How to create NON SINGLETON beans in Spring ?
Best way to follow and notify an Object's progress in methods?
how to take the entire input string from a jtextfield ?
ThreadPool with different tasks
Looping tasks and thread