Skip to main content

Use BlackBerry DateField with PeerComponent raises various errors

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-08-23

I try to add a BlackBerry DateField to a form defining it as a PeerComponent but i can not get it to work. In the form i use the code

DateField nativeBBDateField = new DateField("", inputDate.getTime(),DateField.DATE);
PeerComponent peer = PeerComponent.create(nativeBBDateField);


When i run this i get the error:

IllegalStateException: UI engine accessed without holding the event lock.

If i then change the createNativePeer method in BlackBerryImplementation to the code below this error disappears but then i get a NullPointerException:

if (nullFld == null) {
nullFld = new NullField();
nullFld.setFocusListener(new FocusChangeListener() {
public void focusChanged(Field field, int eventType) {
if(lightweightEdit != null) {
synchronized(UiApplication.getEventLock()) {
try {
} catch(Throwable t) {
How can i use the native Blackberry DateField component on a lwuit form?
Kind Regards,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2003-11-07

Thanks, that seems like a good fix. If you have a stack trace to go with the null pointer exception that would help us narrow down the problem. Feel free to open an issue on the matter.