title: Why does BitmapFactory decodeFile return null?
body: <p>I've been following the Android developers guide to create an app that uses an existing camera app to take some photos. Next I'm trying to put them into an imageview using this part of the guide <a href="https://developer.android.com/training/camera/photobasics.html#TaskScalePhoto" rel="nofollow noreferrer">https://developer.android.com/training/camera/photobasics.html#TaskScalePhoto</a>
  but BitmapFactory decodeFile is returning null. I simplified it to the following code but it gives the same result.</p>
  
  <pre><code>Bitmap bitmap = BitmapFactory.decodeFile(mCurrentPhotoPath);
  imageView.setImageBitmap(bitmap);
  </code></pre>
  
  <p>mCurrentPhotoPath was set to <code>image.getAbsolutePath()</code> and an example is
  storage/emulated/0/Android/data//files/Pictures/JPEG_20170503_102533_2060032401.jpg</p>
  
  <p>I can hard code the value of mCurrentPhotoPath to a known photo and I still get null.</p>
  
  <p>However if I replace that with
  storage/emulated/0/DCIM/Camera/IMG_20161124_145814981_HDR.jpg
  (a photo created separately using my phones normal camera app) then it works.</p>
  
  <p>I have</p>
  
  <pre><code>uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
  </code></pre>
  
  <p>in my manifest. The 2 files have the same permissions and are about the same size. I can copy them elsewhere and they seem to be valid jpeg files.
  Any ideas what could be going on?</p>
  
  <p>I've looked through many posts and tried a number of things including the variation below but I get the same result.</p>
  
  <pre><code>File dest = new File(mCurrentPhotoPath);
  FileInputStream fis = null;
  fis = new FileInputStream(dest);
  Bitmap img = BitmapFactory.decodeStream(fis);
  smallPhoto.setImageBitmap(img);
  </code></pre>