本文介绍了我怎样才能在安排黑莓特定线程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

欲自动调度一个线程与特定的时间间隔。我还需要在后台continously没有挂起的设备执行这一点。

I want to auto-schedule a thread with a particular time interval. I also need to execute this in the background continously without hangs to the device.

我与应用程序管理器类试过,但它是应用程序的调度,我需要在应用程序内调度线程。

I have tried this with Application Manager Class but it's for application scheduling and I need to schedule thread within the application.

推荐答案

我会用的:

public class MyScreen extends MainScreen {
    private Timer mTimer;
    public MyScreen() {
        mTimer = new Timer();
        //start after 1 second, repeat every 5 second
        mTimer.schedule(mTimerTask, 0, 5000);
    }

    TimerTask mTimerTask = new TimerTask() {
        public void run() {
            // some processing here
        }
    };
}

看BlackBerry API隐藏的宝石(第二部分)

这篇关于我怎样才能在安排黑莓特定线程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 06:33
查看更多