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
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

HomeScreen HomeScreen.updateIcon() NullPointerException

Hi All,

 

I want to change my application HomeScreen Icon, however, when I set new ICON, it will throws an exception.

 

I do not know what wrong with it.

It just happened on my BB 8310 handheld with os 4.5.0.18 Platform 2.7.0.43

 

here is error message:

 

NullPointerException
No detail message
net_rim_bb_ribbon_app-2
 RibbonApiProxy
 <private>
 0x454A
net_rim_bb_ribbon_app-2
 RibbonApiProxy
 <private>
 0x45B3
net_rim_bb_ribbon_app-2
 RibbonApiProxy
 setIcon
 0x4380
net_rim_bb_framework_api
 HomeScreen
 updateIcon
 0x19FF
net_rim_bb_framework_api
 HomeScreen
 updateIcon
 0x19D4
WICAppManager-1
 AppManager
 <private>
 0x37F
WICAppManager-1
 AppManager
 <init>
 0x6D6
WICAppManager-1
 AppManager
 getInstance
 0x754
WICAppManager-1
 AppManager
 main
 0x641

 

my source code is:

 

/* VERSION_DEPENDED_NOT: 4.0 */ private void setNormalIcon() { if ((icon != null) && (icon.normal != null)) { HomeScreen.updateIcon(icon.normal); } }

 

 

Thanks!

Developer
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: HomeScreen HomeScreen.updateIcon() NullPointerException

I wrote a test application,

 

The same thing happen on 8310,v4.5.0.18

 

/* * test.java * * © <your company here>, 2003-2008 * Confidential and proprietary. */ import net.rim.device.api.ui.component.*; import net.rim.device.api.ui.*; import net.rim.device.api.ui.container.MainScreen; import net.rim.device.api.ui.UiApplication; import net.rim.device.api.system.*; import net.rim.device.api.servicebook.*; import net.rim.device.api.ui.container.*; import net.rim.blackberry.api.homescreen.*; /** * */ public class test extends UiApplication implements Runnable{ boolean onoff; Bitmap b1,b2; public static void main(String args[]){ UiApplication theApp = new test(); theApp.enterEventDispatcher(); } public test() { b1 = Bitmap.getBitmapResource("1.png"); b2 = Bitmap.getBitmapResource("2.png"); Thread t = new Thread(this); t.start(); } public void run() { int counter =50; try{ while(true){ if(counter<0) break; Thread.sleep(10000); refreshIcon(); counter--; } }catch(Exception ex){} } private void refreshIcon() { try{ onoff = !onoff; if(onoff) HomeScreen.updateIcon(b1); else HomeScreen.updateIcon(b2); }catch(Exception ex){ System.out.println(ex.toString()); } } }

 

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

Re: HomeScreen HomeScreen.updateIcon() NullPointerException

Do you see the same results for updateIcon(b#, 0)?
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
Jeff_Lu
Posts: 384
Registered: ‎08-12-2008
My Device: 8700

Re: HomeScreen HomeScreen.updateIcon() NullPointerException

Hi Mark,

 

I did not test that.

 

but After I upgraded to 4.5.0.110

 

it works fine.

 

Thanks