title: android - save file to internal storage
body: <p>I know this is a double post but the other threads didn't answer my question.
  I want to write a file to the directory of my app inside the Android directory in the internal storage</p>
  
  <p>I added the permission to the manifest:</p>
  
  <p><strong>Manifest.xml</strong> Code:</p>
  
  <pre><code> &lt;uses-permission android:name="android.permission.WRITE_INTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>and <strong>Java</strong> code:</p>
  
  <pre><code> File myPath = new File(getFilesDir(), "test.dat");            
      myPath.mkdirs();
      FileOutputStream fos = null;
      try {
          fos = new FileOutputStream(myPath);
          fos.write(bytes);
      } catch (Exception e) {
  
      }
  </code></pre>
  
  <p>however the directory for my app is not created and I cannot find the filename via search.</p>
  
  <p><strong>EDIT:</strong>
  there is actually a FileNotFoundException thrown, my bad.
  But I thought that mkdirs() would create all missing directories. </p>