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

trying to find workaround to RIM bug

Working with JDE 4.2.2, targeting 8800 series (for the moment) I've noticed that although I can now avoid the IllegalArgumentException thrown by HomeScreen.setRolloverIcon( ) there is still one issue remaining.

 

When I download the cod OTA,while no exception is thrown, the ribbion will not display the rollover icon until the unit is soft-booted (ALT-SHIFT-DEL).  This occurs on an 8820 running OS 4.5

 

In the following code, I decided to try to eliminate this error by wrapping the icon setting code in an invokeLater().  This proved ineffective, and a regression, as without this, the original version would result in the rollover icon being immediately visible UNLESS the OTA download was made without deleting the prior (same) version.

 

Is there a known way to get this to work without requiring a soft-boot?

 

public class Dib extends UiApplication {

    /**
     * Primary 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();
        }
    }

    public Dib(boolean ribbonClicked) {
        if(ribbonClicked){
            // Start the application
            this.pushScreen(new SplashScreen(UiApplication.getUiApplication() , new GameScreen()));
        }else{
            // Setup ribbon icons and exit.
            final Bitmap icon1 = Bitmap.getBitmapResource("icon.png");
            final Bitmap icon2 = Bitmap.getBitmapResource("icon2.png");
           
            invokeLater(new Runnable(){
                public void run(){
                    ApplicationManager appMgr = ApplicationManager.getApplicationManager();
                   
                    // Setup the icons once Blackberry is able.
                    while(appMgr.inStartup()){
                        // Sleep until Blackberry has completed startup
                         try {
                             Thread.sleep(1000);
                         }
                         catch (Exception ex) {
                             // Eat expected exceptions
                         }
                    }
                   
                    // Now setup application icons
                    try{
                        HomeScreen.updateIcon(icon1, 1);
                        HomeScreen.setRolloverIcon(icon2, 1);
                    }catch(IllegalArgumentException ex){
                        /* Trap & ignore this exception,
                         * which is the result of a known bug.
                         */
                    }
                   
                    //Exit the application.
                    System.exit(0);
                }
            });
        }
    }
}

 

Comments?  Ideas?

 

Patrick

 

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: trying to find workaround to RIM bug

Posting the a link to the other discussion where this is being discussed.

 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&thread.id=3623&view=by_date_...

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
Developer
Berrysoft
Posts: 143
Registered: ‎07-14-2008
My Device: Not Specified

Re: trying to find workaround to RIM bug

Yes, but that thread doesn't answer this specific question, nor address this specific code.

 

So, if any have a comment on this code solution, please post.