Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

154
Vistas
insert image grabbed from galleries/photos into my EditText before sending

I'm trying to grab an image from the galleries/photos and insert it in my EditText and sending it only after I click on the send button. I believe the title is self explanatory.

Before opening this question thread, I tried to collect as much information from all others related questions found here in OverFlow.

So far here is what I have:

    public void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) {
        super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
        Bitmap yourSelectedImage = null;
        switch(requestCode) {
            case Constant.SELECT_IMAGE:
                if (resultCode == RESULT_OK) {
                    Uri selectedImage = imageReturnedIntent.getData();

                    try {
                        yourSelectedImage = MediaStore.Images.Media.getBitmap(getActivity().getContentResolver(), selectedImage);
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                    if (yourSelectedImage != null) {
                        typeMessageEditText.setCompoundDrawables(new BitmapDrawable(getResources(), yourSelectedImage)
                                ,null, null, null);
                    }
                }
        }

        }

    @Override
    public void onClick(View view) {
        switch (view.getId()) {
            case (R.id.insertPhotoImage):
                onStartGalleryPhotos();
                break;
            default:
                break;
        }

    }
    private void onStartGalleryPhotos() {
        Intent intent = new Intent();
        intent.setType("image/*");
        intent.setAction(Intent.ACTION_GET_CONTENT);
        startActivityForResult(Intent.createChooser(intent, Constant.SELECT_PICTURE), Constant.SELECT_IMAGE);
    }
}

DEBUG:

typeMessageEditText is my EditText where I'm trying to get the image inserts. I tried debugging the onActivityResult and I'm seeing that the URI is actually being retrieved so I believe that part is working. However, when I convert my bitmap into a drawable and insert it in my EditText, nothing is actually showing in my EditText in my emulator.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda