Hi Shai
Thanks for helping :)
I think I cannot see the wood for the trees. so I try the example from the gallery Icon Update:
using the code( see below) in the Netbeans Simulator running on Windows.
And I get the same errors.
Questions:
1. In the netbeans project where should I create the .cn directory? would this solve it ?
2. Is there a bug in the simulator that gives only a single trailing "/" for file urls.
i.e. (String) ev.getSource(); always gives file:/thefile.png rather than file://thefile.png
I get the same error for both formulations of the file URL.
3. Running the code under on windows and netbean simulator the picker always gives me the file:/C:/file.png formulation
should I recast this in the test code running on the simulator to file://thefile.png and place it in the .cn directory?
4. I do not understand why it complains about resources when I am trying to load a local device file and not one from the resources directory
-------------------------------
Display.getInstance().openGallery(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
if (ev != null && ev.getSource() != null) {
String filePathToGalleryImageOrVideo = (String) ev.getSource();
System.out.println("filePathToGalleryImageOrVideo " + filePathToGalleryImageOrVideo);
try {
Image codeNameOneImage = EncodedImage.create(filePathToGalleryImageOrVideo);
} catch (IOException ex) {
Logger.getLogger(CodeScan.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
}, Display.GALLERY_ALL);
-------------------------------------------------------------------
Output is :
Load form test scenario
filePathToGalleryImageOrVideo file:/C:/CrunchifyQR.png
ERROR: resources must reside in the root directory thus must start with a '/' character in Codename One!
Invalid resource: file:/C:/CrunchifyQR.png
[EDT] 0:0:0,0 - java.lang.NullPointerException
[EDT] 0:0:0,2 - java.lang.NullPointerException
java.lang.NullPointerException
at com.codename1.io.Util.copy(Util.java:116)
at com.codename1.io.Util.copy(Util.java:102)
at com.codename1.io.Util.readInputStream(Util.java:169)
at com.codename1.ui.EncodedImage.create(EncodedImage.java:269)
at com.codename1.ui.EncodedImage.create(EncodedImage.java:425)
at com.xxx.xxx.CodeScan$1.actionPerformed(CodeScan.java:92)