List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development

Friday, September 20, 2013

Splash / Loading Screen in Blackberry

The following code will display splash screen.
public class App extends UiApplication {
     public static App theApp;
   
     public static void main(String[] args) {
       
                 theApp = new App();
                 theApp.enterEventDispatcher();   
           
           
        }  
   
    public App() {
          
            splash next = null;
            splash1 splash1=new splash1(this ,next);
            pushScreen(splash1);
           

    }
}

splash1 class is given below-
    public splash1(UiApplication app, splash next){
        application=app;
        VerticalFieldManager vfm=new VerticalFieldManager();
        final Bitmap header_Bitmap =Bitmap.getBitmapResource("splash.png");
        BitmapField bit =new BitmapField(header_Bitmap);
        vfm.add(bit);
        add(vfm);
      
         timer = new Timer();
         timer.schedule(new CountDown(), 1000);
             
    }

     public class CountDown extends TimerTask {
          public void run() {
             DismissThread dThread = new DismissThread();
             application.invokeLater(dThread);
          }
       }
     public void dismiss() {
          timer.cancel();
          application.popScreen(this);
       
          application.pushScreen(next);
       }
       public class DismissThread implements Runnable {
              public void run() {
                 dismiss();
              }
           }
}

splash class is the landing page(Home page)-
public class splash extends MainScreen {
        public splash(){
    //Here you can add your fields.......
  }
}

2 comments: