title: BitmapFactory.decodeFile e/bitmapfactory unable to decode stream java.io.filenotfoundexception EACCES (Permission denied)
body: <p>I tried to take a picture from storage, and display it in ImageView using BitmapFactory.decodeFile but i found error unable to decode stream java.io.filenotfoundexception EACCES (Permission denied), i'm using android 10 emulator API 30.</p>
  <p>this is my code :</p>
  <pre><code>@Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (resultCode == RESULT_OK)
          {
              if(requestCode == REQUEST_GALLERY)
              {
                  Uri dataimage = data.getData();
                  String[] imageprojection = {MediaStore.Images.Media.DATA};
                  Cursor cursor = getContentResolver().query(dataimage,imageprojection,null,null,null);
  
                  if (cursor != null)
                  {
                      cursor.moveToFirst();
                      int indexImage = cursor.getColumnIndex(imageprojection[0]);
                      part_image = cursor.getString(indexImage);
  
                      Toast.makeText(this, &quot;Image Saved Part Image :&quot; + part_image, Toast.LENGTH_SHORT).show();
  
                      if(part_image != null)
                      {
                          File image = new File(part_image);
                          imgHolder.setImageBitmap(BitmapFactory.decodeFile(image.getAbsolutePath()));
                          Toast.makeText(this, &quot;Image Saved Part Image :&quot; + image, Toast.LENGTH_SHORT).show();
                      }
                  }
              }
          }
      }
      
  </code></pre>
  <p>I have added this to my Android manifest :</p>
  <pre><code>&lt;uses-permission android:name=&quot;android.permission.WRITE_EXTERNAL_STORAGE&quot; /&gt;
  &lt;uses-permission android:name=&quot;android.permission.READ_EXTERNAL_STORAGE&quot;/&gt;
  </code></pre>
  <p>and this :</p>
  <pre><code>&lt;application
  ...
  android:requestLegacyExternalStorage=&quot;true&quot;&gt;
  </code></pre>
  <p>This is my error log :</p>
  <pre><code>E/BitmapFactory: Unable to decode stream: java.io.FileNotFoundException: /storage/0000-0000/DCIM/Camera/IMG-20200714-WA0008.jpg: open failed: EACCES (Permission denied)
  </code></pre>
  <p>any help solution ?</p>