Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 06:40, 15 August 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Como repetir a execução de uma tarefa agendada

From Wiki
Jump to: navigation, search
Article Metadata

Por maiconherverton
Última alteração feita por hamishwillee em 15 Aug 2013

Se você deseja criar uma repetição de uma tarefa agendada a cada n milissegundos em Java ME você deve usar uma classe TimerTask, inserindo o código no método run.

import java.util.TimerTask;
public class MyTask extends TimerTask {
public void run() {
// Execução do código

Então, devemos reaproveitar esta tarefa da seguinte maneira:

crono = new Timer();
task = new MyTask();
// A cada 1 segundo passado, execute.
crono.schedule(task, 0, 1000);
This page was last modified on 15 August 2013, at 06:40.
42 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.