Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!