Revision as of 05:26, 5 June 2009 by tanjaluodes (Talk | contribs)

How to execute a repeated scheduled task

From Nokia Developer Wiki
Jump to: navigation, search

If you want to create an repeated scheduled task every xxx milliseconds in Java ME you should use a TimerTask class, inserting the code in the run method.

import java.util.TimerTask;
public class MyTask extends TimerTask {
public void run() {
//Code to execute

Then, we should use this task in this way:

crono = new Timer();
task = new MyTask();
//Schedule every 1 second starting right now
crono.schedule(task, 0, 1000);
61 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.