Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Multithreading 我需要这样一个线程,可以运行在后台确定后,每秒钟的时间,在黑莓_Multithreading_Blackberry - Fatal编程技术网

Multithreading 我需要这样一个线程,可以运行在后台确定后,每秒钟的时间,在黑莓

Multithreading 我需要这样一个线程,可以运行在后台确定后,每秒钟的时间,在黑莓,multithreading,blackberry,Multithreading,Blackberry,嗨 我需要这样一个线程,可以运行在后台,确定后,每秒钟的时间,在黑莓。如果任何代码或链接有人知道。请发过来 提前感谢。以下是代码: public class MyApp extends Application { public Timer _timer; public TimerTask _timerTask; public static void main(String[] args) { MyApp theApp = new MyApp(); the

我需要这样一个线程,可以运行在后台,确定后,每秒钟的时间,在黑莓。如果任何代码或链接有人知道。请发过来


提前感谢。

以下是代码:

public class MyApp extends Application
{

public Timer _timer;
public TimerTask _timerTask;


public static void main(String[] args)
{   
    MyApp theApp = new MyApp();       
    theApp.enterEventDispatcher();
}
public MyApp()
{               

    _timer = new Timer();
    _timerTask = new TimerTask(){
        public void run() {
        //Do what u want here   

    }; 
   _timer.scheduleAtFixedRate(_timerTask, 0,10000);
}    
}

请注意,MyApp类是扩展应用程序而不是UiApplication,这会使此应用程序隐藏,如果您还想从菜单中隐藏此应用程序的图标,请转到Blackberry_app_Descriptor.xml文件并选中“不要在主屏幕上显示应用程序图标”,如果您想在启动时自动启动此应用程序,请选中同一文件中的“启动时自动启动”