It has been updated since but here is the new processing code
import android.content.Intent;
BMS b;
fileInput f;
void setup() {
size(600,600,P2D);
b = new BMS(this);
f = new fileInput(this);
//f.folder = true;
//f.file = true;
f.image = true;
};
void draw() {
background(255);
f.displayImage();
f.readContents();
};
void mousePressed() {
f.getItem();
};
//@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
f.handleActivity(requestCode,resultCode,data);
};
you need to download the github filewriterv1.jar
when using folder
the files get sent to their respective arraylists
public String[] listFiles(String s1) {
String []s = null;
String path = s1;
println("Files", "Path: " + path);
File directory = new File(path);
File[] files = directory.listFiles();
if (files!=null) {
s = new String [files.length];
println("Files", "Size: "+ files.length);
for (int i = 0; i < files.length; i++)
{
s[i] = files[i].getName();
Files.add(s[i]);
filterAll(s[i]);
println("Files", "FileName: " + files[i].getName());
}
}
println("Images", images.size());
println("text", textFiles.size());
println("Audio", audioFiles.size());
println("Other", otherFiles.size());
return s;
};
there is also a video files arrayList videoFiles, just forgot to print it out
when loading an image the image gets stored to fileInput.img or whatever your fileInput instance is called.
when loading a file it gets stored to fileContent which is a String object, note it is not a String[] array and /n is used to separate lines.