processing-android icon indicating copy to clipboard operation
processing-android copied to clipboard

selectInput() is not working in Android mode.

Open bizkitj opened this issue 8 years ago • 3 comments

` void setup() { selectInput("Select a file to process:", "fileSelected"); }

void fileSelected(File selection) { if (selection == null) { println("Window was closed or the user hit cancel."); } else { println("User selected " + selection.getAbsolutePath()); } }`

switch from Java mode to Android mode, processing gives error, Am I doing something stupid?

bizkitj avatar Feb 16 '17 10:02 bizkitj

Hi, unfortunately the selectInput() function is not currently implemented in the Android mode, essentially due to the reason we discussed in #295: there is no native file selection widget in Android. I will mark this as en enhancement, but cannot give you at this time an estimate on when this will be addressed.

codeanticode avatar Feb 16 '17 19:02 codeanticode

@codeanticode The simplest to way to implement this would be to use the native file browser app. This app is mostly available on all the devices. Processing-android will call startActivityForResult which will start the file browser activity. It is explained here - http://stackoverflow.com/questions/7856959/android-file-chooser

omerjerk avatar Feb 18 '17 07:02 omerjerk

Also, there is a library that adds this functionality: android-select-file

codeanticode avatar May 15 '17 13:05 codeanticode