title: hide activity when return from intent camera or intent gallery onActivityResult android
body: <p>I have an dialog who call to "Take from camera" or "Take from gallery" for add a new photo, this code works good, my problem is when return or close the intent if take a photo o take image from gallery. My activity from I called the intent camera and gallery, It's hide for approx 3 second and show again. My data in screen not lost, and show the image good, I did all but not find the solution for that. Repeat, open the camera with intent for camera or gallery, take a photo and camera finish, when I saw, my activity is hiding, my app all is hiding, later it show. Same with gallery.</p>
  
  <p>Here my code:</p>
  
  <pre><code>case 0:
      Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
      // Ensure that there's a camera activity to handle the intent
      if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
            // Create the File where the photo should go
            File photoFile = createImageFile();
  
            // Continue only if the File was successfully created
            if (photoFile != null) {
                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT,
                                      Uri.fromFile(photoFile));
                mUriPhoto = Uri.fromFile(photoFile);
                startActivityForResult(takePictureIntent, TAKE_CAMERA);
             }
       }
       break;
  case 1:
       Intent takeGallery = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
       takeGallery.setType("image/*");
       startActivityForResult(takeGallery, TAKE_GALLERY);
       break;
  </code></pre>
  
  <p>And here my onActivityResult:</p>
  
  <pre><code>protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (resultCode == RESULT_OK) {
          switch (requestCode) {
              case TAKE_CAMERA:
                  ...
                  break;
              case TAKE_GALLERY:
                  ...
                  break;
          }
      }
  }
  </code></pre>
  
  <p>If anyone can help, I'd appreciate it. Thank you</p>