title: Bitmap decode File return null
body: <p>I use intent with action <code>android.provider.MediaStore.ACTION_IMAGE_CAPTURE</code> to capture image and get a path of the the image. After got the path, I decode it to a bitmap. </p>
  
  <pre><code>Bitmap photoBitmap = BitmapFactory.decodeFile(currentPhotoPath);
  </code></pre>
  
  <p>All work well on <strong>Device1</strong>, the log for image path look like this :</p>
  
  <pre><code>/storage/emulated/0/Pictures/QPOS/IMG_20160622_110127_1473532607.jpg
  </code></pre>
  
  <p>Then I run the app to a new device call <strong>Device2</strong>.
  The image path I got after capture image:</p>
  
  <pre><code>/storage/emulated/0/Pictures/QPOS/IMG_20160622_105436_2068195440.jpg
  </code></pre>
  
  <p>It look normal. But the decode method return a null bitmap at this line</p>
  
  <pre><code>Bitmap photoBitmap = BitmapFactory.decodeFile(currentPhotoPath);
  </code></pre>
  
  <p>I do not know why have different between two device, I build on the same source code. 
  Can you explain why I got null bitmap for method decode file ? And how to fix this issue ? Thanks.</p>
  
  <p>Update:
  I add request permission for API 23 by this method:</p>
  
  <pre><code>private void requestPermissions() {
          Log.d("binh", "request Permision");
          if (Build.VERSION.SDK_INT &gt;= 23) {
              List&lt;String&gt; permissionRequestList = new ArrayList&lt;&gt;();
  
              if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA)
                      != PackageManager.PERMISSION_GRANTED) {
                  permissionRequestList.add(android.Manifest.permission.CAMERA);
              }
  
              if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION)
                      != PackageManager.PERMISSION_GRANTED) {
                  permissionRequestList.add(android.Manifest.permission.ACCESS_FINE_LOCATION);
              }
  
              if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_EXTERNAL_STORAGE)
                      != PackageManager.PERMISSION_GRANTED) {
                  permissionRequestList.add(android.Manifest.permission.READ_EXTERNAL_STORAGE);
              }
  
              if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.WRITE_EXTERNAL_STORAGE)
                      != PackageManager.PERMISSION_GRANTED) {
                  permissionRequestList.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);
              }
  
              if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.READ_PHONE_STATE)
                      != PackageManager.PERMISSION_GRANTED) {
                  permissionRequestList.add(android.Manifest.permission.READ_PHONE_STATE);
              }
  
              if (permissionRequestList.size() &gt; 0) {
                  ActivityCompat.requestPermissions(this, permissionRequestList.toArray(new String[permissionRequestList.size()]), Constants.REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);
              }
          }
      }
  </code></pre>
  
  <p>This is a code to create path for the image:</p>
  
  <pre><code>private File setUpPhotoFile() throws IOException {
          File f = createImageFile();
          currentPhotoPath = f.getAbsolutePath();
          return f;
      }
  
      private File createImageFile() throws IOException {
          String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
          String imageFileName = JPEG_FILE_PREFIX + timeStamp + "_";
          File albumF = getAlbumDir();
          File imageF = File.createTempFile(imageFileName, JPEG_FILE_SUFFIX, albumF);
          return imageF;
      }
  
      private File getAlbumDir() {
          File storageDir = null;
          if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
              //storageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), getString(R.string.app_name));
              storageDir = new File(
                      getExternalFilesDir(Environment.DIRECTORY_PICTURES), getString(R.string.app_name));
              if (storageDir != null) {
                  if (!storageDir.mkdirs()) {
                      if (!storageDir.exists()) {
                          Log.d("CameraSample", "failed to create directory");
                          return null;
                      }
                  }
              }
          } else {
              Log.d(getString(R.string.app_name), "External storage is not mounted READ/WRITE.");
          }
  
  
          return storageDir;
      }
  </code></pre>
  
  <p>After build and granted permission from dialog, I got the same issue. </p>