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
Highlighted
Developer
Posts: 35
Registered: ‎05-18-2011
My Device: BlackBerry 10 Dev Alpha, Blackberry 9700
My Carrier: -

NullPointerException when call manager.replace(...)

Hello!

 

When I call manager.replace(...), the NullPointerException throws on os 4.6 (simulator 8900)

On os 5.0 it isn't.

All fields are initialized.

I dont know why... Please, help!

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: NullPointerException when call manager.replace(...)

errors like this can usually be solved with the debugger. step through the code and check if one of the referenced fields is null.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 35
Registered: ‎05-18-2011
My Device: BlackBerry 10 Dev Alpha, Blackberry 9700
My Carrier: -

Re: NullPointerException when call manager.replace(...)

thanks for reply

 

I have done this like you say, all fields not null

and on jde 5.0 exception not thrown

Developer
Posts: 16,999
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: NullPointerException when call manager.replace(...)

eclipse should show you a stacktrace. you can add an exception breakpoint befor eit occurs.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 35
Registered: ‎05-18-2011
My Device: BlackBerry 10 Dev Alpha, Blackberry 9700
My Carrier: -

Re: NullPointerException when call manager.replace(...)

thanks for help

 

When I compared stacktraces in JDE 4.6 and 5.0, I saw the difference:

 

on 4.6 ST looks like this:

 

13 MyButtonField.sublayout( int, int )

12 Manager.layout( int, int )

11 Manager.layoutChild( Field, int, int )

10 VerticalFieldManager.sublayout( int, int )

9 Manager.layout( int, int )

8 Manager.layoutChild( Field, int, int)

7 VerticalFieldManager.incrementalLayout( int, int, int )

6 Manager.runLayoutUpdate0( int, int, int )

5 Manager.runLayoutUpdate0( int, int, int )

4 Manager.runLayoutUpdate0( int, int, int )

3 Manager.runLayoutUpdate( int, int, int )

2 Manager.delete( Field )

1 Manager.replace( Field, Field )

 

on 5.0 like this but without line 2: Manager.delete( Field )

 

do you know, why 4.6 invokes Manager.delete( Field )

 

At all, I avoid my problem by implementing myField.setBitmap() to get another state of field =)