title: How to create a file on Android Internal Storage?
body: <p>I want to save a file on internal storage into a specific folder. My code is:</p>
  
  <pre><code>File mediaDir = new File("media");
  if (!mediaDir.exists()){
     mediaDir.createNewFile();
     mediaDir.mkdir();
  
  }
  File f = new File(getLocalPath());
  f.createNewFile();
  FileOutputStream fos = new FileOutputStream(f);
  fos.write(data);
  fos.close();
  </code></pre>
  
  <p><code>getLocalPath</code> returns <code>/data/data/myPackage/files/media/qmhUZU.jpg</code> but when I want to create the media folder I'm getting the exception "java.io.IOException: Read-only file system". Any ideas how to write my files on internal phone storage in in folder media? Thanks.</p>