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
New Contributor
mmarinov
Posts: 4
Registered: ‎04-23-2011
My Device: BlackBerry Curve 8520
Accepted Solution

HomeScren.supportsIcons() throws a RuntimeException

When the following code is executed on a device or a simulator with OS 6.0 which has an active theme with an animated GIF for home screen background, a RuntimeException "Index 1 >= 1" is thrown:

 

 

try { 
    updateIcons(); 
} catch (RuntimeException e) { 
    Logger.logError("Runtime exception: " + e.getMessage()); 
} 

private void updateIcons() { Logger.logDebugInfo("updateIcons"); if (HomeScreen.supportsIcons()) { Logger.logDebugInfo("The current theme supports icons"); HomeScreen.updateIcon(Bitmap.getBitmapResource("Main Icon.png"), 0); Logger.logDebugInfo("main icon updated"); HomeScreen.setRolloverIcon(Bitmap.getBitmapResource("Main Icon Active.png"), 0); Logger.logDebugInfo("rollover icon set"); } else { Logger.logDebugInfo("The current theme does not support icons"); } Logger.logDebugInfo("End of updateIcons"); }

 Logger is a wrapper class for net.rim.device.api.system.EventLogger.

 

The output from the above code in the event log is:

 

updateIcons
Runtime exception: Index 1 >= 1

 

 

If I remove the "if (HomeScreen.supportsIcons())" line and the "else" line, everything is fine:

 

updateIcons
The current theme supports icons
main icon updated
rollover icon set
End of updateIcons

 

I ran the code snippet on application startup, on application startup from an alternate entry point and on menu command click and the result was always the same.

 

I built the application with BlackBerry Plugin for Eclipse v1.2 in Eclipse 3.4 (for BB OS4.7), then I tried with BlackBerry Plugin for Eclipse v1.3 in Eclipse 3.6 (for BB OS6), but there was no difference in the HomeScreen.supportsIcons() behavior on OS6.0 - it always threw a RuntimeException if the active theme had specified an animated theme for home screen background.

 

The exception is thrown when the background is an animated GIF (regardless of how it has been set to loop - forever or just once), but never when it is a static picture or a slide show.

 

So, I wonder whether the supportsIcons check is really important and what would happen if the code is executed on a device which uses a theme without icons (I personally have never come across such one).

 

And, of course, my big question is: is it a bug or am I doing something wrong?

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

Re: HomeScren.supportsIcons() throws a RuntimeException

I haven't been able to reproduce this. Can you provide the exact version you are seeing this one? You can find this under Options, About on the BlackBerry Smartphone.
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.
New Contributor
mmarinov
Posts: 4
Registered: ‎04-23-2011
My Device: BlackBerry Curve 8520

Re: HomeScren.supportsIcons() throws a RuntimeException

Hello, Mark,

 

I am sorry for my delayed response.

The versions are:

 

real device:

BlackBerry 9800, v6.0.0.246, (Bundle 695, Platform 6.4.0.105)

 

simulators:

BlackBerry 9800,v6.0.0.337, (Bundle 1165, Platform 3.0.0.100)

BlackBerry 9800,v6.0.0.246, (Bundle 695, Platform 3.0.0.90)

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

Re: HomeScren.supportsIcons() throws a RuntimeException

I've tried a few images and haven't been able to reproduce this. Can you provide a link to an example image or theme that causes this?
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.
New Contributor
mmarinov
Posts: 4
Registered: ‎04-23-2011
My Device: BlackBerry Curve 8520

Re: HomeScren.supportsIcons() throws a RuntimeException

The problem was found by a customer who was using this theme:

http://appworld.blackberry.com/webstore/content/18313?lang=en

 

I also created these sample themes with animated backgrounds (don't pay attention to the poor GIF file quality, this was the only suitable animated GIF I had):

 

http://bazzz.eu/bbtestthemes/Animated_Theme_9800_1.zip (the animation loops forever)

http://bazzz.eu/bbtestthemes/Animated_Theme_9800_2.zip (the animation is run once).

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

Re: HomeScren.supportsIcons() throws a RuntimeException

Thank you for the sample themes.  I was able to reproduce it using them.  I've reported this issue to our development team and logged it in Issue Tracker here:  https://www.blackberry.com/jira/browse/JAVAAPI-1796

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.
New Contributor
mmarinov
Posts: 4
Registered: ‎04-23-2011
My Device: BlackBerry Curve 8520

Re: HomeScren.supportsIcons() throws a RuntimeException

Mark,

 

thank you very much for your time spent in investigating the problem. I really appreciate your help.

Please use plain text.
Regular Contributor
walkin
Posts: 52
Registered: ‎11-24-2011
My Device: Bold 9930

Re: HomeScren.supportsIcons() throws a RuntimeException

[ Edited ]

Any progress in fixing this bag?

... 

BTW, here http://www.ency9.com/gadget/homescrensupportsicons-throws-a-runtimeexception/

I've found that it happens only " when the background is an animated GIF".

Please use plain text.