# How to save data in a program

**URL:** <https://discourse.processing.org/t/how-to-save-data-in-a-program/35525>\
**Category:** Processing for Android\
**Created:** [March 2, 2022, 11:31pm UTC](https://discourse.processing.org/t/how-to-save-data-in-a-program/35525 "2022-03-02T23:31:40Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![jafal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jafal/32/19112_2.png) [@jafal](https://discourse.processing.org/u/jafal)\
**Post date:** [March 4, 2022, 8:32am UTC](https://discourse.processing.org/t/how-to-save-data-in-a-program/35525/10 "2022-03-04T08:32:37Z")

</div>

Hi

Hi

This example from APDE I just changed the path

```auto
String[] lines;
int index = 0;
String filepath = "/storage/emulated/0/test/positions.txt/";
void setup() {
  size(800, 800);
  background(0);
  stroke(255);
  frameRate(12);
  lines = loadStrings(filepath);

    
}

void draw() {
  if (index < lines.length) {
    String[] pieces = split(lines[index], '\t');
    if (pieces.length == 2) {
      int x = int(pieces[0]) * 2;
      int y = int(pieces[1]) * 2;
      point(x, y);
    }
    // Go to the next line for the next run through draw()
    index = index + 1;
  }
}

```

Read this

> [@Permission issue in reading file from external storage](https://discourse.processing.org/t/permission-issue-in-reading-file-from-external-storage/34184/12):
>
> I tried to work around the path separator issue by using File and Scanner: void loadEnv( String f) { String dir = new String(Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+image\_folder+"/"); File file = new File( dir+f); try { println( dir+f); Scanner sc = new Scanner(file); println(sc.next()); } catch (Exception e) { println(e); text("File not found", width/2, height/2); } } Then it returns permission error: java.io.FileNotFoundException: …

---

_[View the full topic](https://discourse.processing.org/t/how-to-save-data-in-a-program/35525)._
