title: startActivityForResults not working when the child activity calls another activity
body: <p>I have 3 activities say A, B and C.</p>
  
  <p>A calls B. </p>
  
  <p>When B doesn't call C it returns to A. But when B calls C it doesn't return to A, the app stops.</p>
  
  <p>Now the real problem is, from activity A I want to call an image picker and crop the image. That's Activity B which crops and calls C for picking image. </p>
  
  <p>Activity A:</p>
  
  <pre><code>    iv_profile_pic.setOnClickListener(new  View.OnClickListener() {//iv_profile_pic is an ImageView
          @Override
          public void onClick(View view) {
              Intent i=new Intent(MainActivity.this,profile_pic_chooser.class);
              i.setFlags(0);
              MainActivity.this.startActivityForResult(i, 999);
  
              Toast.makeText(getApplicationContext(),"Reached",Toast.LENGTH_SHORT).show();
  
          }
      });
  </code></pre>
  
  <hr>
  
  <pre><code>@Override
      public void onActivityResult(int requestCode, int resultCode, Intent data)
      {
          if (requestCode == 999) {
              Bitmap image=data.getParcelableExtra("picture");
  
              iv_profile_pic.setImageBitmap(image);
  
  
          }
      }
  </code></pre>
  
  <p>Activity B:</p>
  
  <p>It has 2 buttons. Load and Crop. Load when clicked calls ImageChooserIntent and chooses an image which is opened in B with guidlines to crop. </p>
  
  <p>Crop when clicked should return back to A the cropped image. </p>
  
  <p>If crop is called without calling load, it returns to A with null, of-course.
  But if Load is clicked first and then Crop is called, the app simply stops.</p>
  
  <pre><code> public void onLoadImageClick(View view) {
  
          startActivityForResult(getPickImageChooserIntent(), 200);
   }
  </code></pre>
  
  <hr>
  
  <pre><code>public void onCropImageClick(View view) {
          Bitmap cropped =  mCropImageView.getCroppedImage(500, 500);
          if (cropped != null) {
              mCropImageView.setImageBitmap(cropped);
              iv.setImageBitmap(cropped);
  
              Intent returnIntent = new Intent();
              returnIntent.putExtra("picture", cropped);
              setResult(Activity.RESULT_OK, returnIntent);
              finish();
          }
      }
  </code></pre>
  
  <hr>
  
  <pre><code>@Override
      protected void onActivityResult(int  requestCode, int resultCode, Intent data) {
          if (resultCode == Activity.RESULT_OK) {
              Uri imageUri =  getPickImageResultUri(data);
  
              // For API &gt;= 23 we need to check specifically that we have permissions to read external storage,
              // but we don't know if we need to for the URI so the simplest is to try open the stream and see if we get error.
              boolean requirePermissions = false;
              if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.M &amp;&amp;
                      checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED &amp;&amp;
                      isUriRequiresPermissions(imageUri)) {
  
                  // request permissions and handle the result in onRequestPermissionsResult()
                  requirePermissions = true;
                  mCropImageUri = imageUri;
                  requestPermissions(new String[]{Manifest.permission.READ_EXTERNAL_STORAGE}, 0);
              }
  
              if (!requirePermissions) {
                  mCropImageView.setImageUriAsync(imageUri);
              }
          }
      }
  </code></pre>