Permission issue in reading file from external storage

Hi

This not my code I don’t remember where I got it I think it’s belong for @noel

I have other code you have to determined the folder of saved data inside sketch I am going to post it when I found it

For now see this code

String[] SaveData = new String[1];
String[] LoadData = new String[1];
String[] FileData = {"My text is in here"};
String FileName = "File1.txt";

void setup() {
  fullScreen();
  
  SaveData[0] = "No data saved yet";
  LoadData[0] = "No data loaded yet";
  
}

void draw() {
  background(255);
  
  //Save data section and graphics
  fill(255, 0, 0);
  stroke(0);
  strokeWeight(2);
  rect(0, 0, width, height/2);
  fill(0);
  textSize(25);
  text("Click here to save", width/2 - textWidth("Click here to save")/2, height/4 - 25);
  text(SaveData[0], width/2 - textWidth(SaveData[0])/2, height/4 + 25);
  
  //Save if mouse is pressed below the half of the screen height
  if (mousePressed && mouseY < height/2) {
    //save to the name FileName or make a new txt called FileName inside of the data folder
    
    //comment this out to save the text in the string you set above
    FileData[0] = str(round(random(10)));
    SaveData = FileData;
    saveStrings(FileName, FileData);
    background(0);
    println("Saved");
    
  }
  
  //Load data section and graphics
  fill(0, 255, 0);
  stroke(0);
  strokeWeight(2);
  rect(0, height/2, width, height/2);
  fill(0);
  textSize(25);
  text("Click here to load", width/2 - textWidth("Click here to load")/2, height/2 + height/4 - 25);
  text(LoadData[0], width/2 - textWidth(LoadData[0])/2, height/2 + height/4 + 25);
  
  //Load if mouse is Pressed above half of the screen height
  if (mousePressed && mouseY > height/2) {
    //load the file from the directory of FileName which is inside of the data folder
    LoadData = loadStrings(FileName);
    background(0);
    println("Loaded");
    
  }
  
}

I run it with APDE

Edit

imaginativeCODE

Mar '19