Java 在发送之前,将从图库/照片中抓取的图像插入我的编辑文本

Java 在发送之前,将从图库/照片中抓取的图像插入我的编辑文本,java,android,android-contentprovider,Java,Android,Android Contentprovider,我正试图从图库/照片中抓取一幅图像,并将其插入我的编辑文本中,然后仅在单击“发送”按钮后发送。我相信这个标题是不言自明的 在打开这个问题线程之前,我试图从OverFlow中找到的所有其他相关问题中收集尽可能多的信息 到目前为止,我的情况如下: public void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { super.onActivityResult(r

我正试图从图库/照片中抓取一幅图像,并将其插入我的编辑文本中,然后仅在单击“发送”按钮后发送。我相信这个标题是不言自明的

在打开这个问题线程之前,我试图从OverFlow中找到的所有其他相关问题中收集尽可能多的信息

到目前为止,我的情况如下:

    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);
    }
}
调试:


typeMessageEditText
是我试图获取图像插入的EditText。我试着调试onActivityResult,我看到URI实际上正在被检索,所以我相信这部分工作正常。但是,当我将位图转换为可绘制位图并将其插入到EditText中时,我的emulator中的EditText中实际上没有显示任何内容

我想知道如果你真的看到这张照片,你会寄什么。也尝试发送它。为什么不使用普通的图像视图来显示位图呢?我有一个编辑文本,用户可以在其中输入消息或图片。如果用户想要发送图片,应用程序应在用户单击“插入”按钮后打开图库/照片。当用户从图库中选择照片时,该照片应在发送前返回edittext中。