how to create splash screen for blackberry storm
I want to made an application. When i open this application first it display on image for 10 second开发者_如何学编程s and after that it go to another screen automatically.
How it is possible Please give the help.
Why would you want a splash screen for 10seconds? Thats like forever..
But I would do it by creating a screen like this:
public class SplashScreen extends MainScreen {
public SplashScreen() {
super();
this.setTitle("loading...");
// add you splash screen images or whatever here
final Screen me = this;
new Thread(){
public void run() {
// do something that takes a long time
try { Thread.sleep(10000);} catch (Exception e) {}
synchronized (UiApplication.getEventLock()) {
Screen next = new YourNextScreen(); // replace with your next screen here
UiApplication.getUiApplication().pushScreen(next);
UiApplication.getUiApplication().popScreen(me);
}
}
}.start();
}
}
Then push it onto the stack from your UiApplcation
class.
Create a MainScreen where you will add a bitmap field to it. And then run a Thread in it like the following:
Thread th = new Thread() {
public void run() {
try { Thread.sleep(10000); } catch (Exception ex) { }
UiApplication.getUiApplication().invokeLater ( new Runnable() { public void run () {
//push your screen
close();
}});
}
};
th.start();
精彩评论