Skip to content

Instantly share code, notes, and snippets.

@kzim44
Created April 11, 2014 05:00
Show Gist options
  • Save kzim44/10441631 to your computer and use it in GitHub Desktop.
Save kzim44/10441631 to your computer and use it in GitHub Desktop.
Android - create world readable file in app private file directory. Useful for capturing images with the stock camera app.
//Remove if exists, the file MUST be created using the lines below
File f = new File(getFilesDir(), "Captured.jpg");
f.delete();
//Create new file
FileOutputStream fos = openFileOutput("Captured.jpg", Context.MODE_WORLD_WRITEABLE);
fos.close();
//Get reference to the file
File f = new File(getFilesDir(), "Captured.jpg");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment