Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 1.56 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. SplashScreen On Blackberry
  2. package main;
  3. import net.rim.device.api.ui.*;
  4. import net.rim.device.api.ui.component.*;
  5. import net.rim.device.api.ui.container.*;
  6. import net.rim.device.api.system.*;
  7.  
  8. import java.util.*;
  9.  
  10. public class SplashScreen extends MainScreen {
  11.     private UiApplication application;
  12.     private Timer timer = new Timer();
  13.     private static final Bitmap _bitmap = Bitmap.getBitmapResource("SPlachS.png");
  14.     public SplashScreen(UiApplication ui) {
  15.         super(Field.USE_ALL_HEIGHT | Field.FIELD_LEFT);
  16.         this.application = ui;
  17.         this.add(new BitmapField(_bitmap));
  18.         SplashScreenListener listener = new SplashScreenListener(this);
  19.         this.addKeyListener(listener);
  20.         timer.schedule(new CountDown(), 5000);
  21.         application.pushScreen(this);
  22.     }
  23.     public void dismiss() {
  24.         timer.cancel();
  25.         application.popScreen(this);
  26.         application.pushScreen(new MyScreen());
  27.     }
  28. .....
  29.        
  30. Thread th = new Thread()
  31.         {
  32.             public void run()
  33.             {
  34.                 try
  35.                 {
  36.                     Thread.sleep(2000);
  37.                 } catch (Exception ex)
  38.                 {
  39.                 }
  40.                 UiApplication.getUiApplication().invokeLater ( new Runnable()
  41.                     {
  42.                         public void run ()
  43.                         {
  44.                             UiApplication.getUiApplication().pushScreen(newScreen);
  45.                             close();
  46.                         }
  47.                     }
  48.                 );
  49.             }
  50.         };
  51.         th.start();