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

NullPointerException is thrown when the isEditable and fieldChangeNotify methods of EditField are overridden

by Retired ‎02-16-2010 03:41 PM - edited ‎09-16-2010 02:40 PM (562 Views)

Summary

 

This article applies to the following:

  • BlackBerry® Java® Development Environment (BlackBerry JDE) 4.2 and later
  • BlackBerry® Device Software 4.2 and later

Details

 

If an application overrides the isEditable method or fieldChangeNotify method of EditField, a NullPointerException is thrown when the application is executed.

 

Cause

 

When an EditField is instantiated, its constructor calls the isEditable and fieldChangeNotify methods. If these methods are overridden, they are called during the instantiation process. During this process, the EditField instance is null. If a call is made to an instance method of the EditField a NullPointerException is thrown.

 

Resolution

 

When overriding the isEditable and fieldChangeNotify methods for an EditField, a check must be done to see if EditField is null before invoking any other instance methods of the EditField.

 

Contributors
Users Online
Currently online: 31 members 433 guests
Please welcome our newest community members: