title: Android: App crashes on onActivityResult while using Camera Intent
body: <p>I am using camera intent to capture images in my App. The problem my app crashes on <code>Android 5.0.2</code> while using camera. I am using intent from fragment. Below is my code inside fragment:</p>
  
  <p><strong>Method to take photo</strong></p>
  
  <pre><code>private void takePhoto() {
      mHighQualityImageUri = Util.generateTimeStampPhotoFileUri(getActivity());
      Log.d(UploadPicturesFragment.class.getSimpleName(),
              "URI: " + mHighQualityImageUri.toString());
      Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      intent.putExtra(MediaStore.EXTRA_OUTPUT, mHighQualityImageUri);
      startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
  }
  </code></pre>
  
  <p><strong>onActivityResult in my fragment</strong></p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode != Activity.RESULT_OK) {
          return;
      }
  
      if (requestCode == REQUEST_IMAGE_CAPTURE) {
      Log.d(UploadPicturesFragment.class.getSimpleName(),
                  "IMAGE URI NOT NULL: " + (mHighQualityImageUri == null));
          try {
              Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(),
                      mHighQualityImageUri);
              DroomUtil.beginCrop(mHighQualityImageUri, getActivity(), this, true, bitmap.getWidth(),
                      bitmap.getHeight());
          } catch (FileNotFoundException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p><strong>Log Trace</strong></p>
  
  <pre><code>12-29 10:28:03.491: E/AndroidRuntime(9780): java.lang.RuntimeException:       Unable to resume activity {in.droom/in.droom.activity.MainActivity}:     java.lang.RuntimeException: Failure delivering result    ResultInfo{who=android:fragment:2, request=1, result=-1, data=null} to activity   {in.droom/in.droom.activity.MainActivity}: java.lang.NullPointerException:   Attempt to invoke virtual method 'java.lang.String android.net.Uri.getScheme()'   on a null object reference
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3224)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3257)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2479)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.access$800(ActivityThread.java:144)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1359)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.os.Handler.dispatchMessage(Handler.java:102)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.os.Looper.loop(Looper.java:155)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.main(ActivityThread.java:5702)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at java.lang.reflect.Method.invoke(Native Method)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at java.lang.reflect.Method.invoke(Method.java:372)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1029)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:824)
  12-29 10:28:03.491: E/AndroidRuntime(9780): Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=android:fragment:2, request=1, result=-1, data=null} to activity {in.droom/in.droom.activity.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getScheme()' on a null object reference
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3881)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3197)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     ... 11 more
  12-29 10:28:03.491: E/AndroidRuntime(9780): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.getScheme()' on a null object reference
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.content.ContentResolver.openInputStream(ContentResolver.java:651)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.provider.MediaStore$Images$Media.getBitmap(MediaStore.java:1019)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at in.droom.fragments.UploadPicturesFragment.onActivityResult(UploadPicturesFragment.java:395)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.Activity.dispatchActivityResult(Activity.java:6164)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     at android.app.ActivityThread.deliverResults(ActivityThread.java:3877)
  12-29 10:28:03.491: E/AndroidRuntime(9780):     ... 12 more
  </code></pre>
  
  <p>The line no. 395 is:</p>
  
  <pre><code>Bitmap bitmap = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(),
                      mHighQualityImageUri);
  </code></pre>