title: Getting all the time "permission denied" or "no such file or directory" by trying to save Bitmap image. What should i do?
body: <p>I`m trying to save Bitmap image by this code:</p>
  
  <pre><code>File sdcard = Environment.getExternalStorageDirectory();
              String filename = "test";
              File folder = new File(sdcard, "/Download");
              Log.v("ImageStorage1", "EXiST?: " + folder.exists());
              folder.mkdirs();
              Log.v("ImageStorage2", "EXIST!: " + folder.exists());
              Log.v("ImageStorage", "Folder: " + folder);
              File file = new File(folder, filename + ".jpg");
  
              try {
                  FileOutputStream out = new FileOutputStream(file.getAbsoluteFile());
                  result.compress(Bitmap.CompressFormat.JPEG, 90, out);
                  out.flush();
                  out.close();
              } catch (Exception e) {
                  e.printStackTrace();
              }
  </code></pre>
  
  <p>I`m also using in manifests file:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  </code></pre>
  
  <p>But i`m getting this one:</p>
  
  <pre><code>V/ImageStorage1: EXiST?: true
  V/ImageStorage2: EXIST!: true
  W/System.err: java.io.FileNotFoundException: 
  /storage/emulated/0/Download/test.jpg (Permission denied)
      W/System.err:     at java.io.FileOutputStream.open0(Native Method)
      W/System.err:     at java.io.FileOutputStream.open(FileOutputStream.java:287)
      W/System.err:     at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:223)
      W/System.err:     at java.io.FileOutputStream.&lt;init&gt;(FileOutputStream.java:171)
  </code></pre>
  
  <p>Actually, my task is to store to another folder and when I`m using this:</p>
  
  <pre><code>File folder = new File(sdcard, "/kpi/test/a");
  </code></pre>
  
  <p>I`m getting </p>
  
  <pre><code>V/ImageStorage1: EXiST?: false
  V/ImageStorage2: EXIST!: false
  (No such file or directory)
  </code></pre>
  
  <p>Even with:</p>
  
  <pre><code>folder.mkdirs();
  </code></pre>
  
  <p>I tried a lot and surfed a lot, but haven`t found an answer :(</p>