Date/Time Picker Displaying Jumbled

25 views
Skip to first unread message

pw...@thevisioncouncil.org

unread,
Apr 20, 2018, 7:47:00 PM4/20/18
to CodenameOne Discussions
I'm trying to implement a date and time picker.  I've tried both of the following methods:

    Picker dateTimePicker = new Picker();
    dateTimePicker.setType(Display.PICKER_TYPE_DATE_AND_TIME);
    dateTimePicker.setDate(new Date());

    PickerComponent meetingDate = PickerComponent.createDateTime(signInList.dateOfMeeting.get()).label("Meeting Date/Time");

Both ways appear to work identically to me and both display completely jumbled and unusable when the picker is opened.  This is in all simulator skins I have (a few iOS and a few Android) as well as on an Android device (Yoga tablet).  I have made some small changes to my theme but I doubt they would cause the kind of display issues I'm seeing.  I attached a screenshot.

I'm using Intellij IDEA on Windows 10 with the latest version of everything.

P.S.  Couldn't post this on Stack Overflow.  Not only can we not attach anything (or at least I couldn't figure out how to) it wouldn't let me post this question because I asked one less than 90 minutes ago.
Capture.JPG

Shai Almog

unread,
Apr 21, 2018, 12:36:29 AM4/21/18
to CodenameOne Discussions
That's a regression in the simulator in recent updates. Notice that rendering on the device will look completely different.

We are working on replacing the picker component entirely with something that would hopefully solve the constant problems we are running into with that component.

Paul Wade

unread,
Apr 21, 2018, 3:09:30 AM4/21/18
to CodenameOne Discussions
Actually, I'm having this problem on the device as well as I mentioned in my post.  I'm not able to screenshot it because it addition to appearing as it does above, it disappears after about two seconds.  I've created a video though.  It looks like a loo but I'm just robotic :).  https://www.dropbox.com/s/54gviij65wjnetd/DateTimePickerBugDemo.mp4?dl=0

I'm currently attempting a workaround by using a separate picker for date and time, then combining into a single Date.  It actually looks nice on the form that way.  Just a bit more code.

Shai Almog

unread,
Apr 22, 2018, 12:19:48 AM4/22/18
to CodenameOne Discussions
Don't use Date & Time Picker anywhere other than iOS. Use a separate Date picker and Time picker as Android doesn't support both in a single widget. Since this isn't supported natively it falls back to the problematic code that runs in the simulator.

The way to detect this in code is:

if(Display.getInstance().isNativePickerTypeSupported(Display.PICKER_TYPE_DATE_AND_TIME)) {
...
} else {
...
}


Reply all
Reply to author
Forward
0 new messages