Android build fail(windows)(selectInput() and selectOutput() on android)

I was trying to build something for a android phone, but i got an error that said there’s an error with




so, i want to ask if someone knows how to ask for files on android??

ps. blah,blah means that i don’t want to fill in stuff


With android that kind of thing can be done with an alertDialog: you create it, give it some title, populate it with a charSequenceArray (got from listFiles() depending where are supposed to be your files), add this array with the alertdialog setItems() method then add to the items some OnClickListener().

Dont forget to add WriteExternalStorage Permission and use a runnable to add your Dialog to P5.

1 Like

Okay, can you make a thing because i don’t know how to apply that, i will probably understand code better.
But still thanks.

(i am noob)

Sorry, i dont think it is good to answer as you ask for; i can help seeing what you try…

  • begin to add some simple AlertDialog to your app
    details here:
  • secondly try to get a list of your files (let us say in the DCIM directory); for that use java listFiles()
  • after you have this array[] or this ArrayList() look at the setItems method from the alertDialog
  • try to populate your AlertDialog with the items from the array or arrayList
  • then add onClickListener to the items (required because alertDialog items implements that)
  • finally put your code as a method inside a runnable and call this method when you want (on mouseReleased eg)

dont forget permission (on runtime)

as i said, i don’t know how to apply just text, but i do understand code a little bit more.

i am noob

Can you give an example, please?

what have you tried till now: put your code.

my code right now is very bad and this:

byte[] i = null;
byte[] a = null;
byte[] o;
String OLoc = null;

void setup() {
  background(0, 0, 0);
  size(106, 37);
void imgSelected(File selection) {
  if (selection==null) {
  } else {
    i = loadBytes(selection.getAbsolutePath());
void archSelected(File selection) {
  if (selection==null) {
  } else {
    a = loadBytes(selection.getAbsolutePath());
void outSelected(File selection) {
  if (selection==null) {
  } else {
    OLoc = selection.getAbsolutePath();
    if (i != null && a != null && OLoc != null) {
      o = concat(i, a);
      saveBytes(OLoc, o);

void draw() {
  background(255, 255, 255);
  fill(255, 255, 255);
  fill(255, 255, 255);
  if(i != null){fill(0,255,0);}
  rect(0, 0, width, height/3);
  fill(255, 255, 255);
  if(a != null){fill(0,255,0);}
  rect(0, height/3, width, height/3);
  fill(255, 255, 255);
  rect(0, (height/3)*2, width, height/3);

  fill(0, 0, 0);
  text("SELECT IMAGE", width/2-40, height/6+6);
  text("SELECT ARCHIVE", width/2-49, (height/6)*3+6);
  text("SAVE", width/2-10, (height/6)*5+6);
void mousePressed() {
  if (mouseY >= 0 && mouseY <= height/3-1) {
    selectInput("Select Image", "imgSelected");
  if (mouseY >= height/3+1 && mouseY <= (height/3)*2-1) {
    selectInput("Select Archive", "archSelected");
  if (mouseY >= (height/3)*2+1 && mouseY <= height-1) {
    selectOutput("Save", "outSelected");

@Bunnygamers === this code has not any chance to work with android; so, i have already told you begin to create an AlertDialog , see the link i have put.

Thanks for the help.

But i still don’t understand.

@Bunnygamers === selectInput() does not work with android: instead you have to use an alertDialog as i have described and it has absolutely no sense that i put code for that if you try nothing.