title: Permission denied on writing to external storage despite permission
body: <p>I have an Android 7.0 test device and my APK targets = "targetSdkVersion 22", with:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>final File f = new 
  File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) + File.separator + "DressUpBaby" + photonumber + ".png");
  f.createNewFile();
  </code></pre>
  
  <p>and at this point I get the warning:</p>
  
  <pre><code>W/System.err: java.io.IOException: Permission denied
  </code></pre>
  
  <p>How to get it to save the file? This was working when I created this on Eclipse, but now that I have updated and moved to Android Studio it seems to have broken something.</p>