title: RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent
body: <p>I want to <strong>upload image to Firebase</strong> after capturing by <strong>Camera</strong>, But getting an error saying "<strong>Failure delivering result</strong>". Configuration of Firebase is all perfect. Just after capturing the image and while I click on proceed app Crashing.</p>
  
  <p>This is my <strong>ActivityMain.Java</strong>:</p>
  
  <pre><code>package com.example.intuition.firebase;
  
  import android.app.ProgressDialog;
  import android.content.Intent;
  import android.net.Uri;
  import android.provider.MediaStore;
  import android.support.annotation.NonNull;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.Button;
  import android.widget.ImageView;
  import android.widget.Toast;
  
  import com.google.android.gms.tasks.OnFailureListener;
  import com.google.android.gms.tasks.OnSuccessListener;
  import com.google.firebase.storage.FirebaseStorage;
  import com.google.firebase.storage.StorageReference;
  import com.google.firebase.storage.UploadTask;
  import com.squareup.picasso.Picasso;
  
  public class MainActivity extends AppCompatActivity {
      private StorageReference mStorageRef;
      public Button mUpload;
      public ImageView mImageView;
      private static final int CAMERA_REUEST_CODE = 1;
      private ProgressDialog mProgress;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          mStorageRef = FirebaseStorage.getInstance().getReference();
          mUpload = (Button) findViewById(R.id.upload);
          mImageView = (ImageView) findViewById(R.id.imageView);
          mProgress = new ProgressDialog(this);
  
          mUpload.setOnClickListener(new View.OnClickListener(){
              @Override
              public void onClick(View view){
                  Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                  startActivityForResult(intent, CAMERA_REUEST_CODE);
              }
          });
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
          if (requestCode == CAMERA_REUEST_CODE &amp;&amp; resultCode == RESULT_OK){
              mProgress.setMessage("Uploading...");
              mProgress.show();
  
              Uri uri = data.getData();
              StorageReference filepath = mStorageRef.child("Photos").child(uri.getLastPathSegment());
              filepath.putFile(uri).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
                  @Override
                  public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                      mProgress.dismiss();
                      Uri downloadUri = taskSnapshot.getDownloadUrl();
                      Picasso.with(MainActivity.this).load(downloadUri).fit().centerCrop().into(mImageView);
  
                      Toast.makeText(MainActivity.this, "Uploaded...", Toast.LENGTH_LONG).show();
  
                  }
              });
          }
      }
  }
  </code></pre>
  
  <p><strong>LogCat:</strong></p>
  
  <pre><code>FATAL EXCEPTION: main
  
  
  Process: com.example.intuition.firebase, PID: 4694
                                           java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { act=inline-data (has extras) }} to activity {com.example.intuition.firebase/com.example.intuition.firebase.MainActivity}: java.lang.NullPointerException
                                               at android.app.ActivityThread.deliverResults(ActivityThread.java:3592)
                                               at android.app.ActivityThread.handleSendResult(ActivityThread.java:3635)
                                               at android.app.ActivityThread.access$1300(ActivityThread.java:151)
                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390)
                                               at android.os.Handler.dispatchMessage(Handler.java:110)
                                               at android.os.Looper.loop(Looper.java:193)
                                               at android.app.ActivityThread.main(ActivityThread.java:5333)
                                               at java.lang.reflect.Method.invokeNative(Native Method)
                                               at java.lang.reflect.Method.invoke(Method.java:515)
                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
                                               at dalvik.system.NativeStart.main(Native Method)
                                            Caused by: java.lang.NullPointerException
                                               at com.example.intuition.firebase.MainActivity.onActivityResult(MainActivity.java:57)
                                               at android.app.Activity.dispatchActivityResult(Activity.java:5535)
                                               at android.app.ActivityThread.deliverResults(ActivityThread.java:3588)
                                               at android.app.ActivityThread.handleSendResult(ActivityThread.java:3635) 
                                               at android.app.ActivityThread.access$1300(ActivityThread.java:151) 
                                               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1390) 
                                               at android.os.Handler.dispatchMessage(Handler.java:110) 
                                               at android.os.Looper.loop(Looper.java:193) 
                                               at android.app.ActivityThread.main(ActivityThread.java:5333) 
                                               at java.lang.reflect.Method.invokeNative(Native Method) 
                                               at java.lang.reflect.Method.invoke(Method.java:515) 
                                               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824) 
                                               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640) 
                                               at dalvik.system.NativeStart.main(Native Method) 
  </code></pre>