If you are experiencing an issue please mention the full platform your issue applies to:
Hi, while testing my app on an iPhone, my filechooser shows the name of the file (in this a case an image) as temp_image.jpg. I emailed this image from my phone to my desktop email and its name is listed as XXXXXX.png.
ActionListener callback = e->{
if (e != null && e.getSource() != null) {
String filePath = (String)e.getSource();
//File newFile = new File(filePath);
String dir = FileSystemStorage.getInstance().getAppHomePath() +"/myApp";
FileSystemStorage storage = FileSystemStorage.getInstance();
storage.mkdir(dir);
Log.p("" + new File(dir).exists());
List<String> filepathParsed = StringUtil.tokenize(filePath, "[/.]");
for (int j = 0; j < filepathParsed.size(); j++)
Log.p(j +": " + filepathParsed.get(j));
Log.p("last: " + filepathParsed.get(filepathParsed.size() -1));
StringBuilder hi = new StringBuilder(filePath);
if (filePath.startsWith("file://"))
hi.delete(0, 7);
int lastIndexPeriod = hi.toString().lastIndexOf(".");
//StringBuilder newFileName = new StringBuilder(filePath);
//hi.replace(lastIndexPeriod - 1, lastIndexPeriod, "/file");
Log.p(hi.toString());
String hmore = hi.toString().substring(0, lastIndexPeriod -1);
String ext = hi.toString().substring(lastIndexPeriod);
//String[] last = hi.toString().split("/");
String hi2 = hmore + "/file" + ext;/*hi;*/
List<String> last = StringUtil.tokenize(hi.toString(), "/");/*hi.toString().split("/");*/
//FIXME!
if (filePath == null) {
Log.p("no file was selected");
} else {
initializeSpinner();
}
if (FileChooser.isAvailable()) {
FileChooser.showOpenDialog(".pdf,application/pdf,.png,image/png,.jpg,image/jpg,.jpeg, image/jpeg", callback);
} else {
Display.getInstance().openGallery(callback, Display.GALLERY_IMAGE);
}
}
Also: Is there a way to open a native (at least iOS) dialog to open both images and PDF files, instead of only Display.getInstance().openGallery(callback, Display.GALLERY_IMAGE); ??
Thanks!