Android Mode saving and loading txt file

I found that if you put your “example.txt” inside a folder called data and put the data folder inside of your sketch folder then it loads up just fine.

p.s. this works with images and all other things you want to save and load. Also don’t write the “loadStrings” or “loadImage” like this - “loadStrings(“data/Example.txt”)”. The way I found to load and save is like this - “loadStrings(“Example.txt”)”. I don’t know why this works? But it does!

Here’s some example code below and images

PImage ExampleImage;
String[] ExampleText = new String[1];

void setup() {
  
  fullScreen();
  
  ExampleImage= loadImage("TestImage.png");
  ExampleText = loadStrings("TestStrings.txt");
  
}

void draw() {
  
  image(ExampleImage, 0, 0, width, height);
  fill(0);
  textSize(33);
  text(ExampleText [0], width/2 - textWidth(ExampleText [0])/2, height/2);
  
}

Inside of sketch folder
InSketchFolder

Inside of data folder
InsideDataFolder

Keep in mind that in future processing updates they might do it differently. I spent lots of time going threw old posts that didn’t work any more. I just had to figure it out by myself. Hope this helps some of you people trying to solve this.

1 Like