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文件并选中“不要在主屏幕上显示应用程序图标”,如果您想在启动时自动启动此应用程序,请选中同一文件中的“启动时自动启动”