Where is the sketch path on Android phone

edited September 2016 in Android Mode

Hi,

I am making a quick app for a class and I need to know where the sketch is saved to on my Android S3 phone. I mostly need to know how to save images from the sketch and get access to these images. I tried the save() function, but I can't find my file. I have WRITE_EXTERNAL_STORAGE permission, just need to know what path to give or where the default path is taking my files.

Thanks, ~Mikeshiny

Answers

  • Never mind. I solved it. I just had to save to "//sdcard//whatever.jpg" Then the file shows up in my file system on my phone. This was all I really needed. Now I can copy it to wherever I want.

    ~Mikeshiny

  • edited November 2013

    That's the way, because I guess they are internally saved in /data/data/name_of_your_app/... and that place needs root permissions.

  • Indeed, you cannot access an application's internal storage on a device that isn't rooted. Saving to the external storage (not necessarily the SD card) is the way to go. On some devices, however, the path to this location isn't /sdcard/ - on my S4, for example, the path is /storage/emulated/0/. You should use Android's native methdods to obtain the location of the External Storage (this returns a File) (DCIM is the directory that I have used in the past, it might need some more tweaking to become ideal):

    Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM)
    
  • @calsign

    I was wondering if you could put up an example of code. I'm having the darnedest time trying to use saveFrame() on android. I've even tried the "\sdcard\whatever.png" but no luck.

  • edited December 2013

    You might run into some trouble with saveFrame() (although you may not, I'm not entirely sure). If you do, you'll need to find a workaround...

    Try this:

    String path = (new File(Environment.getExternalStoragePublicDirectory(
        Environment.DIRECTORY_DCIM)
        .getParentFile(), "MySketchFiles"))
        .getAbsolutePath();
    
Sign In or Register to comment.