title: Having trouble implementing ACTION_OPEN_DOCUMENT to my project
body: <p>I have AddActivity, which lets you get the URI from either a picture you can take from the camera, or an image that you can select from the gallery. Then you can go to DetailsActivity to view the image. I have it working right now until you restart the device. After you restart and try to go to DetailsActivity for that image, this is the error:</p>
  
  <pre><code>Caused by: java.lang.SecurityException: Permission Denial: opening provider com.android.providers.media.MediaDocumentsProvider from ProcessRecord{3a5e86d 2915:jeremy.com.wineofmine/u0a321} (pid=2915, uid=10321) requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs
  </code></pre>
  
  <p>I went to the <a href="https://developer.android.com/guide/topics/providers/document-provider.html" rel="noreferrer">"Open Files Using Storage Access Framework"</a> Android Development page and read up on the Persist Permissions section. I'm having trouble applying it to my project though.</p>
  
  <p>I think the main thing I don't understand is that it looks like you need to call an intent (in my case inside the DetailsActivity), but I don't even have an intent there. </p>
  
  <p>Here is the intent that lets you pick the gallery image. This is in AddActivity:</p>
  
  <pre><code>Intent intentGallery = new Intent(Intent.ACTION_OPEN_DOCUMENT);
              intentGallery.addCategory(Intent.CATEGORY_OPENABLE);
              intentGallery.setType("image/*");
              intentGallery.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
              intentGallery.addFlags(Intent.FLAG_GRANT_WRITE_URI_PERMISSION);
              startActivityForResult(intentGallery, SELECT_IMAGE);
  </code></pre>
  
  <p>In the DetailsActivity, this is where it actually crashes:</p>
  
  <pre><code>imageURI = Uri.parse(cursor.getString(cursor.getColumnIndexOrThrow(WineContract.WineEntry.COLUMN_WINE_IMAGE)));
  
  bitmap = null;
      try {
          //If the cursor does not have anything in the image column, set the image to null, with a height so the textviews look decent
          if (cursor.isNull(cursor.getColumnIndexOrThrow(WineContract.WineEntry.COLUMN_WINE_IMAGE))){
              mFullImage.setImageBitmap(null);
              mFullImage.setMaxHeight(300);
          }else{
              //remake the bitmap from the URI in the image column
        //********This next line is where the program crashes**********
              bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageURI);
              mFullImage.setImageBitmap(bitmap);
  
          }
  </code></pre>
  
  <p>Could I get some help with figuring out how to apply this to my project?</p>