title: How to capture photo and get image and thumbnail?
body: <p>I cannot believe that I've struggled with this simple problem for hours now, but I cannot get it to run properly. In principle I want this functionality:</p>
  
  <p><strong>The user clicks a button. An <code>ACTION_IMAGE_CAPTURE</code> intent is fired and the default camera app opens. The user takes the photo and returns to my app. My app shows the thumbnail. Clicking the thumbnail opens the image viewer.</strong></p>
  
  <p>Actually pretty simple. And with this guide it seemed like it was a matter of copy and paste: <a href="https://developer.android.com/training/camera/photobasics.html" rel="noreferrer">https://developer.android.com/training/camera/photobasics.html</a>. But the devil is in the details.</p>
  
  <p>Currently, it does work, but performance is horrible because I create the thumbnails (in my actual app I show multiple thumbnails for each entry in a <code>RecyclerView</code>) on the fly. I hope there is a simple approach that I overlooked during searching through dozens of Stack Overlow questions.</p>
  
  <p><strong>Ideally, I'd like to fire my <code>ACTION_IMAGE_CAPTURE</code> intent, have the default camera app generate the thumbnail, store the thumbnail and the image in the system's content providers for thumbnails and images and finally get the respective content:// URIs back in <code>onActivityResult()</code>.</strong> That would be so nice...</p>
  
  <p>Now, here are the problems I'm facing:</p>
  
  <ul>
  <li>The URI I receive when invoking <code>getData()</code> on the resulting intent in <code>onActivityResult()</code> is always <code>null</code> whether or not I give a <code>MediaStore.EXTRA_OUTPUT</code> value along with the invoking intent</li>
  <li>When omitting the <code>MediaStore.EXTRA_OUTPUT</code> extra I get the thumbnail in form of a bitmap and not as a content:// URI. So, I have to persist the thumbnail myself if I don't want to generate it next time I start my activity.</li>
  <li>I don't understand why I don't get the thumbnail if I pass the camera a content:// URI to save the image to. I mean, the camera has the image loaded in memory and could easily generate the thumbnail. But instead, I have to load multiple MB from disk again just to generate the thumbnail. That seems like a huge waste even if I save the thumbnail for further usage afterwards.</li>
  <li>I have read that some camera apps actually do create the thumbnail in any case and make it available to the gallery or something. But it seems not to be standardized.</li>
  </ul>
  
  <p>So, I guess my wish two content:// URIs simply is not how it works. But before I proceed to generate (eventually duplicate) thumbnails myself and persist and cache them in my app I want to ask:</p>
  
  <p><strong>Is there some easy way I'm not aware of? Is it possible to retrieve both, image and thumbnail or do I have to generate the thumbnail myself?</strong></p>
  
  <p>Note: I want to make the photos taken with my app available to the gallery by letting Android add it to the media database. I can't imagine that every app that accesses that media database (like the gallery) creates it's own set of thumbnails, right?</p>
  
  <p>Thanks in advance!</p>