Search This Blog

Thursday, 22 March 2012

How to display a welcome screen on application startup

Hello friends,
                              So ,yesterday what i was trying is to give my application some professional look by displaying a screen with application logo and a little bit photoshop work kind of you know like some banner for some seconds,this gives the application nice here it is how can you display a screen with an image or anything for some seconds and then it automatically pops up and the mainScreen of app comes on display...

the first thing is to push the main screen of you follows in a main thread.....basically its a file in blackberry there we push the screen which we want to display on app startup.So here below i aam pushing my main screen in stack...

public MyApp(){

pushScreen(<MainScreen of my app>);
 //Now push the screen which you want to display for some seconds.
pushScreen(<my Welcome screen>);
//Now i am using a function to pop this welcome screen.
kill(<my welcome Screen>);

Now what u need to do is to copy this below function in your app.

 public void kill(final Screen screen) {
        Timer _timer = new Timer();
        TimerTask _timerTask = new TimerTask(){
            public void run() {
        _timer.schedule(_timerTask, 4000);
Runnable closeScreen = new Runnable(){
    public void run(){
public void closeScr(){

Copy this whole code in your same java file and its done you can change the seconds you want to display your welcome screen by editing the timerschedule,like here i am displaying it for 4 seconds.

Ask for any queries.....

No comments:

Post a Comment