title: Permission denied when creating new file on external storage
body: <p>I need to copy a file from the assets to the external storage. Here is my code:</p>
  
  <pre><code>    File f = new File(Environment.getExternalStorageDirectory() + File.separator
              + "MyApp" + File.separator + "tessdata" + File.separator + "eng.traineddata");
      if (!f.exists()) {
      AssetManager assetManager = getAssets();
      try {
          f.createNewFile();
          InputStream in = assetManager.open("eng.traineddata");
          OutputStream out = new FileOutputStream(Environment.getExternalStorageDirectory() + File.separator
              + "MyApp" + File.separator  + "tessdata" + File.separator + "eng.traineddata");
          byte[] buffer = new byte[1024];
          int read;
              while ((read = in.read(buffer)) != -1)
                      out.write(buffer, 0, read);
              in.close();
              in = null;
              out.flush();
              out.close();
              out = null;
          } catch (IOException e) {
              Log.e("tag", "Failed to copy asset file: ", e);
          }
      }
  </code></pre>
  
  <p>I've also added the permission in the manifet</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>The exception occurred when is executed <code>f.createNewFile()</code>, saying "Permission denied".</p>
  
  <p>How can I fix it please?</p>