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
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

To remove focus on field

Hi all

i am having list of manager added with five field on it.

  for touch event i have made all five field focusable ,

      But at scrolling time i want to show only one field in focus, so for each field i am setting the focus on single field using setFocus() method. it is working fine.

   But my problem is that some times it is giving null pointer exception.

 

can any body help me.

 

Thanks.

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: To remove focus on field

A little more would be useful.  What line is giving the NPE.  What object in the line is actually null?  Why do you think it should not be null?

 

If the NPE is not in your code, then what statement is in your code - you can find that by following the stack trace. 

Please use plain text.
Developer
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: To remove focus on field

Hi peter

 

i am using navigation movement also but it for some othe field.

 

  while i am debuging it is sowing on return super.navigationMovement(dx, dy, status, time);  line in navigationmovement method

 

and touchevent ==null

 

i am not able to find out why it is.

 

Thanks

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: To remove focus on field

Sorry I need more.  Perhaps someone else can figure it out with just this information. 

 

I have had issues with 'setFocus' when it is being invoked as part of some other processing, say like a scroll.  To get round this I have typically moved the setFocus into an invokeLater. You might try this.  But that is just a guess based on insufficient evidence. 

Please use plain text.
Developer
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: To remove focus on field

Hi i am also having insufficient evidence. 

 

means while i am debuging to find null pointer exception my compiler is stoping on return statement of navigation movement method (return super.navigationMovement(dx, dy, status, time);) so even i am also confused  how to find the issue.

 

thanks

Please use plain text.
Developer
simon_hain
Posts: 16,044
Registered: ‎07-29-2008
My Device: Z10 LE
My Carrier: O2 Germany

Re: To remove focus on field

did you set a breakoint exception on nullpointer? if not, do so, but only when you start the application (as the simulator throws tons of them while booting up).
this should show you the call stack and you can see what exactly 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
Please use plain text.
Developer
avinash_kumar_ispg_in
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: To remove focus on field

hi simon

 

i am using break point exception in that only it is stoping on return super.navigationMovement(dx, dy, status, time);

 position which is in navigationmovement method.

and it is displaying  detailMessage=null in exception popup.

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: To remove focus on field

I think you are going to have to recreate the problem with some simple classes that you can paste here so we can have a look at all your code and try it. 

Please use plain text.