title: Getting Failed to find configured root that contains /storage/emulated/0/Pictures/NoteTaking/IMG_20170226_231007.jpg while trying to take a photo
body: <p>I am trying to make an app that takes a photo and displays it using emulator instead of a device. I followed the steps from this <a href="https://developer.android.com/training/camera/photobasics.html" rel="nofollow noreferrer">android doc</a>:</p>
  
  <p>Part 1) Here is my code where it gets stucks : <code>file = FileProvider.getUriForFile(this, "edu.android.notetakingapplication.provider", createFileDir());</code>    </p>
  
  <p>This part is in the Mainxml</p>
  
  <pre><code>    if (!mediaStorageDir.exists()){
          if (!mediaStorageDir.mkdirs()){
              Log.d("NoteTaking", "failed to create directory");
              return null;
          }
      }
  
      String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
      return new File(mediaStorageDir.getPath() + File.separator +
              "IMG_"+ timeStamp + ".jpg");
  }
  </code></pre>
  
  <p>Here is my app manifest file's provider section</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.CAMERA" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
  &lt;provider
          android:name="android.support.v4.content.FileProvider"
          android:authorities="edu.android.notetakingapplication.provider"
          android:exported="false"
          android:grantUriPermissions="true"&gt;
          &lt;meta-data
              android:name="android.support.FILE_PROVIDER_PATHS"
              android:resource="@xml/provider_paths" /&gt;
      &lt;/provider&gt;
  </code></pre>
  
  <p>and provider_paths.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;external-path name="external_files" path="Android/data/edu.android.notetakingapplication/files/Pictures"/&gt;
  &lt;/paths&gt;
  </code></pre>
  
  <p>Part 2) If i keep provider_paths as this</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;paths xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  &lt;external-path name="external_files" path="."/&gt;
  &lt;/paths&gt;
  </code></pre>
  
  <p>I am able to open camera app, take photo and view it on the same page, but, here is the catch, I am storing the path into database and trying to retrieve all the images on a page. Here is when it gives an error:</p>
  
  <pre><code>Unable to decode stream: java.io.FileNotFoundException: /external_files/Pictures/NoteTaking/IMG_20170226_230608.jpg (No such file or directory)
  </code></pre>