How to Share Image + Text together using ACTION_SEND in android?

前端 未结 11 1882
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 09:59

I want to share Text + Image together using ACTION_SEND in android, I am using below code, I can share only Image but i can not share Text with it,

private          


        
11条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-28 10:17

    By accident(the text message part, I had given up on that), I noticed that when I chose Messages App to handle the request, the Message App would open with the text from Intent.EXTRA_SUBJECT plus the image ready to send, I hope it helps.

    String[] recipient = {"your_email_here"};
    Intent intent = new Intent(Intent.ACTION_SEND);
    intent.putExtra(Intent.EXTRA_EMAIL, recipient);
    intent.putExtra(Intent.EXTRA_SUBJECT, "Hello, this is the subject line");
    intent.putExtra(Intent.EXTRA_TEXT, messageEditText.getText().toString());
    intent.putExtra(Intent.EXTRA_STREAM, imageUri);
    intent.setType("image/*");
    

提交回复
热议问题