Discussion Board

Results 1 to 3 of 3

Thread: Splash screen

  1. #1
    Registered User RetroMoFo's Avatar
    Join Date
    Mar 2003
    Posts
    11
    I have some simple code for displaying a splash screen. Assum _canvas refers to an instantiated FullCanvas subclass and that its keyPressed event sets lastKey...

    // Display splash screen
    Display.getDisplay(this).setCurrent(_canvas);
    for (int index = 0; index < 40; index++) {
    try {
    _canvas.repaint();
    if (_canvas.lastKey != -1) break;
    Thread.sleep(50);
    } catch (InterruptedException e) {
    }
    }
    // Do other stuff

    My question is, why does this work on the 7210 emulator and NOT on a 7210 handset? On the actual handset, it displays the splash screen fine, but pressing a key doesn't move on. Hmph. Any ideas?

  2. #2
    Registered User mugent's Avatar
    Join Date
    Mar 2003
    Posts
    10
    I have used this code succesfully i my own apps, you'll need to adapt it for you own uses, but it works great on emulators and my 7650 device.



    public class SplashScreen extends FullCanvas { // note the use of FullCanvas, this is Nokia specific.
    private Display display;
    private Displayable next;
    private int theTime;
    private Timer timer = new Timer();
    private Image SplashImage;

    public SplashScreen( Display display,Displayable next,String PicPath,int theTime) {
    this.display = display;
    this.next = next;
    this.theTime = theTime;
    SplashImage = Common.loadNamedImage("/"+PicPath);
    }

    protected void keyPressed( int keyCode ){
    dismiss();
    }

    protected void paint(Graphics g) {
    g.drawImage(SplashImage, 0, 0, Graphics.TOP|Graphics.LEFT);
    }

    protected void pointerPressed( int x, int y ){
    dismiss();
    }

    protected void showNotify(){
    timer.schedule( new CountDown(), theTime );
    }

    private void dismiss(){
    timer.cancel();
    display.setCurrent(next);
    }

    private class CountDown extends TimerTask {
    public void run(){
    dismiss();
    }
    }
    }

  3. #3
    Registered User wasjkf's Avatar
    Join Date
    May 2003
    Posts
    19
    my question may seem foolish
    but forgive a new programmer

    how to invoke your class , mugent?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved