Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Berrysoft
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified
Accepted Solution

Unable to get the "splash screen" to work using sample

Using the RIM example as a model I have this:

 

public Dib(boolean ribbonClicked) {


        if(ribbonClicked){
            // Start the application
            this.pushScreen(new SplashScreen(UiApplication.getUiApplication() , new GameScreen()));
            //this.pushScreen(new GameScreen());
        }else{

 

<snip>

 

and this:

 

public class SplashScreen extends FullScreen {
    // Private Fields
    private    FullScreen        next;
    private    UiApplication    application;
    private    Timer            timer = new Timer();
  
    private static final Bitmap _bitmap = Bitmap.getBitmapResource("berrysoft_logo.png");
  
    public SplashScreen(UiApplication ui, FullScreen next) {
        super(Field.USE_ALL_HEIGHT | Field.FIELD_LEFT);
       
        this.application = ui;
        this.next = next;

        this.add(new BitmapField(_bitmap));
       
        SplashScreenListener listener = new SplashScreenListener(this);
        this.addKeyListener(listener);

        timer.schedule(new CountDown(), 5000);

        application.pushScreen(this);
    }

<snip (rest is per the example)>  

 

but when I click on the application icon on the ribbon, instead of working (like it does if I just push the GameScreen, it "freezes" (for a few secs), then does nothing (ie never left the ribbon).

 

What is wrong?

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Unable to get the "splash screen" to work using sample

What is the code within your main method?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
Berrysoft
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to get the "splash screen" to work using sample

The Main() works fine, and is tested (note the commented code in my post above), but here is the Main()

 

 

/**
     * Entry point
     */
    public static void main(String[] args) {
        if( args != null && args.length > 0 )
        {
            // Ribbon icon clicked
            if(args[0].equals("clicked")) {
                Dib game = new Dib(true);
                game.enterEventDispatcher();
            }
        }else{
            // Auto launch on startup
            Dib game = new Dib(false);
            game.enterEventDispatcher();
        }
    }
 

It is in the code already posted that the screen is pushed. The code posted in Article Number: DB-00119

just does not work for me.

 

Does someone have a working example?

 

 

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Unable to get the "splash screen" to work using sample

The SplashScreen sample pushes itself onto the display stack within its constructor.  You don't need to push it, just create an instance of it.  By pushing it you're trying to push the same screen onto the stack twice, which isn't allowed.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
Berrysoft
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: Unable to get the "splash screen" to work using sample

OMG, can't believe I didn't see this.  Thanks, I'll give this an additonal try now. 

 

If the example article had the "calling code" this could be avoided by others who can't read like me.  =)

 

A bit odd to push one's self onto the display stack, but then I can see the logic of doing it with a splash screen that then pulls itself off and pushes the next one.  That's why I missed it.

 

Thanks.

 

Please use plain text.
New Developer
johnnyquest
Posts: 13
Registered: ‎12-13-2008
My Device: Not Specified

Re: Unable to get the "splash screen" to work using sample

Where should the actual image file reside with respect to the project. Using the sample code, I only get a blank white screen showing before it finally shows my main screen which leads me to believe it's not finding the image file. Any ideas on how to add the image file?
Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Unable to get the "splash screen" to work using sample

This example assumes it is in the root of your project.

 

Note that if you are using the beta 2 release of the BlackBerry JDE Plug-in for Eclipse there is an issue where it will place files added to the src folder into src folder in your cod file.  This means you'd access the image in the src folder as well.  Our development team is aware of this issue.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.