Codename one showNativePicker() method issue

54 Views Asked by At

I am using showNativePicker() in my Calendar application and when I am selecting a date it will only display current date so how can I manage it to display selected date in showNativePicker() method? Thanks in advance.

This is my code:-

    try{
           Display.getInstance().showNativePicker(Display.PICKER_TYPE_DATE,PivDisplayCalendar.this, value, metaData);
           Storage.getInstance().writeObject("Date", value);
           Log.p(value.toString());
           Dialog.show("Selected Date", value.toString(), "OK", "");
   } 
           catch(Exception e) {
                         e.printStackTrace();
             }
1

There are 1 best solutions below

0
spacepickle On

You are not capturing the value returned by the call to showNativePicker()

Here is an example piece of code. Notice the assignment statement in the second line. You may need to cast/convert this as the method returns Object

try {
  value = Display.getInstance().showNativePicker(Display.PICKER_TYPE_DATE,PivDisplayCalendar.this, value, metaData);
  Storage.getInstance().writeObject("Date", value);
  Log.p(value.toString());
  Dialog.show("Selected Date", value.toString(), "OK", "");
} catch(Exception e) {
  e.printStackTrace();
}