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

**URL:** <https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372>\
**Category:** Processing for Android\
**Created:** [October 11, 2018, 6:16pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372 "2018-10-11T18:16:23Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bunnygamers](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bunnygamers/32/1956_2.png) [@Bunnygamers](https://discourse.processing.org/u/Bunnygamers)\
**Post date:** [October 11, 2018, 6:16pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/1 "2018-10-11T18:16:23Z")

</div>

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

> selectInput(blah,blah);

and

> selectOutput(blah,blah);

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

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [October 12, 2018, 5:45pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/2 "2018-10-12T17:45:27Z")

</div>

@Bunnygamers===

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.

---

<div class="post-metadata">

**Author:** ![Bunnygamers](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bunnygamers/32/1956_2.png) [@Bunnygamers](https://discourse.processing.org/u/Bunnygamers)\
**Post date:** [October 13, 2018, 10:07am UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/3 "2018-10-13T10:07:08Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [October 13, 2018, 10:20am UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/4 "2018-10-13T10:20:31Z")

</div>

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

- begin to add some simple AlertDialog to your app  
details here: [https://developer.android.com/guide/topics/ui/dialogs#java](https://developer.android.com/guide/topics/ui/dialogs#java)
- 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)

---

<div class="post-metadata">

**Author:** ![Bunnygamers](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bunnygamers/32/1956_2.png) [@Bunnygamers](https://discourse.processing.org/u/Bunnygamers)\
**Post date:** [October 14, 2018, 5:39am UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/5 "2018-10-14T05:39:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bunnygamers](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bunnygamers/32/1956_2.png) [@Bunnygamers](https://discourse.processing.org/u/Bunnygamers)\
**Post date:** [February 12, 2019, 12:16pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/6 "2019-02-12T12:16:54Z")

</div>

Can you give an example, please?

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 12, 2019, 3:08pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/7 "2019-02-12T15:08:42Z")

</div>

@Bunnygamers===  
what have you tried till now: put your code.

---

<div class="post-metadata">

**Author:** ![Bunnygamers](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bunnygamers/32/1956_2.png) [@Bunnygamers](https://discourse.processing.org/u/Bunnygamers)\
**Post date:** [February 21, 2019, 5:34pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/8 "2019-02-21T17:34:34Z")

</div>

my code right now is very bad and this:

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

void setup() {
  background(0, 0, 0);
  size(106, 37);
  surface.setResizable(true);
}
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");
  }
}

```

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 21, 2019, 5:39pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/9 "2019-02-21T17:39:28Z")

</div>

@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.

---

<div class="post-metadata">

**Author:** ![Bunnygamers](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bunnygamers/32/1956_2.png) [@Bunnygamers](https://discourse.processing.org/u/Bunnygamers)\
**Post date:** [February 21, 2019, 5:46pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/10 "2019-02-21T17:46:29Z")

</div>

Thanks for the help.

```auto

❤

```

---

<div class="post-metadata">

**Author:** ![Bunnygamers](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/bunnygamers/32/1956_2.png) [@Bunnygamers](https://discourse.processing.org/u/Bunnygamers)\
**Post date:** [February 21, 2019, 5:47pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/11 "2019-02-21T17:47:37Z")

</div>

But i still don’t understand.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [February 21, 2019, 5:58pm UTC](https://discourse.processing.org/t/android-build-fail-windows-selectinput-and-selectoutput-on-android/4372/12 "2019-02-21T17:58:32Z")

</div>

@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.
