title: Closed Gallery without closing app [Android]
body: <p>I'm new in developers world. I have some problems with one issues. I upload a photo from my Gallery from on CreateChooser, but if I have want to go back because I realized that I don't want to upload the photo my app finish at all And I don't know how to make that when I closing the Gallery (chooser) goes to the previous screen or any fragment. </p>
  
  <p>This is my code: </p>
  
  <pre><code>private void mostrarDialogOpciones() {
          final CharSequence[] opciones={"Elegir imagen de Galería","Cancelar"};
          final AlertDialog.Builder builder=new AlertDialog.Builder(getContext());
          builder.setTitle("Elige una opción");
          builder.setItems(opciones, new DialogInterface.OnClickListener() {
              @Override
              public void onClick(DialogInterface dialogInterface, int i) {
                    if (opciones[i].equals("Elegir imagen de Galería")){
  
                             String[] mimeTypes = {"image/jpeg"};
                          Intent intent = new Intent(Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
                                  .setType("image/*")
                                  .putExtra(Intent.EXTRA_MIME_TYPES, mimeTypes);
  
                          startActivityForResult(intent.createChooser(intent,"Seleccione:"),COD_SELECCIONA);
                      }else{
                          dialogInterface.dismiss();
                          //Toast.makeText(getContext(),"Elija una imagen válida",Toast.LENGTH_SHORT).show();
                      }
                  //}
              }
          });
          builder.show();
      }
  </code></pre>
  
  <p>And this my onActivityResult: </p>
  
  <pre><code>public void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      switch (requestCode){
          case COD_SELECCIONA:
              Uri miPath=data.getData();
              imgFoto.setImageURI(miPath);
  
              try {
                  bitmap=MediaStore.Images.Media.getBitmap(getContext().getContentResolver(),miPath);
                  imgFoto.setImageBitmap(bitmap);
  
  
              } catch (IOException e) {
                  e.printStackTrace();
              }
              break;
      }
      bitmap=redimensionarImagen(bitmap,600,800);
  }
  </code></pre>
  
  <p>Forgive my english. I hope you can help me! Thank you. :)</p>