title: How to get the name of a file chosen from Display.getInstance().openGallery() in Codename One?
body: <p>I want to retrieve the name of the file selected from the image gallery and opened in a label/imageviewer in my form.</p>
  
  <p>I need the name since I'm saving file paths in my database and I want to concatenate that file name to a fixed path where I'm storing my images.</p>
  
  <p>I haven't been able to do so, so far since Display.getInstance().openGallery() stores the file in a temp folder and the FileSystemStorage doesn't help since it doesn't save with the original filename, rather a newly user-defined one.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>    uploadImg.addActionListener(e -&gt; {
  
          Display.getInstance().openGallery(evt -&gt; {
              String filePath = (String) evt.getSource();
  
              int fileNameIndex = filePath.lastIndexOf("/") + 1;
              String fileName = filePath.substring(fileNameIndex);
              System.out.println(fileName);
  
              System.out.println(filePath);
              try {
                  InputStream is = FileSystemStorage.getInstance().openInputStream(filePath);
                  Image i = Image.createImage(is);
  
                  Image listingMask = resourceObjectInstance.getImage("refimg2.jpg");
  
                  imgLabel.setIcon(i.fill(listingMask.getWidth(), listingMask.getHeight()));
  
                  imgLabel.setHidden(false);
                  refreshTheme();
              } catch (IOException ex) {
                  System.out.println(ex);
              }
  
          }, Display.GALLERY_IMAGE);
      });
  </code></pre>
  
  <p>For example, here's what I get when I print the different filepaths:</p>
  
  <p>temp7907640882397406003..jpg
  file://C:/Users/User/AppData/Local/Temp/temp7907640882397406003..jpg</p>
  
  <p>I want to know if there's a way to get the name of the file as shown in the image gallery, for instance: "hello.png".</p>
  
  <hr>
  
  <p>Also, I have 2 datespinners. One being the start date of some event and the other, its end. I want the starting values of the 2nd datespinner to change dynamically depending on what has been selected in the first one. How can I achieve this? Otherwise, is there something else to use to do so?</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: typos.</p>
  
  <p>Edit 2: Datespinners.</p>