2011-03-22 94 views
0

我需要在应用程序实例化时显示初始屏幕,我为基于黑莓开发人员知识库(link)的splashScreen编写了一个类。初始屏幕问题

而且它从我以下的问题class.My调用是溅射屏幕只有deley之后出现,如何解决它,如果任何一个有想法请帮助我,谢谢

class Test extends MainScreen{ 

Test(){ 

UiApplication.getUiApplication().invokeLater(new Runnable() 
     { 
      public void run() { 
       UiApplication app=(UiApplication)getApplication(); 

       Bitmap image = Bitmap.getBitmapResource("splah.png"); 
       ListView listView = new ListView(); 
       new SplashScreen(app, listView); 

} 

} 

回答

1

尽量同步(UIApplication的.getEventLock())。它比invokeLater更快。

Test(){ 
synchronized (UiApplication.getEventLock()) { 
UiApplication app=(UiApplication)getApplication(); 
Bitmap image = Bitmap.getBitmapResource("splah.png"); 
ListView listView = new ListView(); 
new SplashScreen(app, listView); 

} 

} 
+0

当我尝试这段代码时,我得到了运行时异常。 – Jisson 2011-03-22 14:52:40