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
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified
Accepted Solution

NullPointerException on HomeScreen.updateIcon()

I consistently get NullPointerException on HomeScreen.updateIcon(...) and HomeScreen.setName(...) methods.  No change if call the alternate version of the methods that take index of the app entry point.   Per JavaDocs, these methods are expected to through only IllegalArgumentException.  NullPointerException smells like an API bug to me.  I have tried to run the program on devices with software version 4.2x, 4.3x and 4.5x.   I am surprised it has not fixed with even version 4.5.  Is there any workaround that anybody is aware of?

 

Here's a sample exception stack:

 

Name: NullPointerException
GUID: 9c3cd62e3320b498
Time: Jul 23, 2008 13:28:04
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
GoogleMobileUpdater-1
 GoogleHomeScreen
 <private>
 0x1DCA
GoogleMobileUpdater-1
 GoogleHomeScreen
 run
 0x1C92
net_rim_cldc-1
 Thread
 run
 0xB3E8
 

Developer
Posts: 191
Registered: ‎04-03-2008
My Device: Bold 9700

Re: NullPointerException on HomeScreen.updateIcon()

If you could post a code sample (incl your jad) that would help.  Are you using multiple entry points, and if so, are you providing the correct entry point index to the method?

BlackBerry Development Advisor
Posts: 15,085
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: NullPointerException on HomeScreen.updateIcon()

Please compare your implementation to the sample found here:

 

How To - Define a rollover icon for an application 
Article Number: DB-00467

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

 

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
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: NullPointerException on HomeScreen.updateIcon()

for (int i = 0; i < 5; i++) { final int j = i; wesly.invokeLater(new Runnable() { public void run() { try { HomeScreen.setName("new name", j); } catch (IllegalArgumentException e) { _LOG.debug("IAE on index " + j); e.printStackTrace(); } catch (NullPointerException npe) { _LOG.debug("NPE on index" + j); npe.printStackTrace(); } } }); }

 


There are only two entry points in the app ( I loop 5 times just on curiousity).  I see "NPE on index n" logged 5 times.

 

Here's my JAD

 

 

Manifest-Version: 1.0 MIDlet-Version: 1.0.0.147 MIDlet-Jar-Size: 229540 RIM-COD-URL-3: myFunkyApp-3.cod RIM-MIDlet-Icon-1-2: img/myFunkyApp.png RIM-COD-SHA1-3: b2 7b 74 79 ff 59 cc b4 aa 5d 5c 30 0a ad a4 93 3d c1 4c 0a RIM-COD-URL-2: myFunkyApp-2.cod MicroEdition-Configuration: CLDC-1.1 MIDlet-Jar-URL: myFunkyApp.jar RIM-MIDlet-Icon-1-1: img/myFunkyApp.png RIM-COD-Module-Dependencies: net_rim_cldc,net_rim_bb_framework_api,net_rim_bbapi_phone,net_rim_os,net_rim_bbapi_mailv2,net_rim_bbapi_invoke,net_rim_pdap,net_rim_bbapi_menuitem RIM-COD-SHA1-2: 07 5a b5 2e db 38 ee d4 5a 1d a8 2c cf c3 23 2b e6 0a 25 b1 RIM-COD-URL-1: myFunkyApp-1.cod RIM-COD-SHA1-1: 75 78 c6 26 2b 83 e1 eb e4 05 1d d0 20 77 6e f3 fb 56 99 89 RIM-COD-Size-3: 20260 RIM-MIDlet-Flags-2: 3 RIM-COD-Size-2: 44172 RIM-MIDlet-Flags-1: 0 RIM-COD-Size-1: 47108 RIM-COD-Module-Name: myFunkyApp RIM-COD-Size: 59324 MIDlet-Name: myFunkyApp RIM-COD-Creation-Time: 1216835275 MIDlet-2: ,img/myFunkyApp.png,autostartup MIDlet-1: myFunky App,img/myFunkyApp.png, RIM-COD-URL: myFunkyApp.cod MIDlet-Description: myFunky App RIM-COD-SHA1: 25 5d 79 16 c3 60 09 0b c5 f2 41 bc bf 4e 68 6f f3 c4 10 d8 MicroEdition-Profile: MIDP-2.0 MIDlet-Vendor: BoxTone RIM-MIDlet-Icon-Count-1: 1

 

 

 

 

 

 

 

 

Developer
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: NullPointerException on HomeScreen.updateIcon()

Mark,   I have gone through that KB article.  That is where I started.

 

 

 Thanks.

BlackBerry Development Advisor
Posts: 15,085
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: NullPointerException on HomeScreen.updateIcon()

Are you seeing the same behaviour with setName(String name)?  Where is your for loop being called from?  In the application's contstuctor, alternate entry point, on some user action (clicking on a button, etc...) or some other action?  Has the application entered the event dispatcher when this code is called?
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
Posts: 52
Registered: ‎07-17-2008
My Device: Not Specified

Re: NullPointerException on HomeScreen.updateIcon()

This code gets invoked on a user action ie button click.  Yes, the application has entered the event dispatcher when this happens.
BlackBerry Development Advisor
Posts: 15,085
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: NullPointerException on HomeScreen.updateIcon()

I was able to use both of the setName methods from within a MenuItem in the BlackBerry Simulator included with version 4.3.0 of the BlackBerry JDE.

 

If I used an entry point that was not valid, I received an IllegalArgumentException saying that the index I specified did not have an entry point.

 

Can you provide a larger code sample that triggers the exception?

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
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: NullPointerException on HomeScreen.updateIcon()

I had this issue recently on a group of folks upgrading to 4.5.  Report from RIM was that it is a known issue on 4.5.0.37 but fixed on 4.5.0.52 (which is not yet in general distribution).

 

I have not seen the problem on 4.3, only this range of 4.5.

 

-de

 

New Developer
Posts: 11
Registered: ‎07-14-2008
My Device: Not Specified

Re: NullPointerException on HomeScreen.updateIcon()

Hi RexDoug,

 

I can confirm being able to reproduce the issue on OS 4.5.0.37 as well. Not sure about 4.5.0.52

 

Regards,

Neil

www.blackberrysmart.com

www.devberry.com