It's not a secret anymore!
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
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "Need Help with Timer Class" Watch "Need Help with Timer Class" New topic

Need Help with Timer Class

Michael Hubele
Ranch Hand

Joined: Dec 17, 2005
Posts: 182

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?

I agree. Here's the link:
subject: Need Help with Timer Class
jQuery in Action, 3rd edition