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

前端 未结 11 1887
隐瞒了意图╮
隐瞒了意图╮ 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条回答
  •  伪装坚强ぢ
    2020-11-28 10:08

    String text = "Look at my awesome picture";
    Uri pictureUri = Uri.parse("file://my_picture");
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_TEXT, text);
    shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
    shareIntent.setType("image/*");
    shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    startActivity(Intent.createChooser(shareIntent, "Share images..."));
    

提交回复
热议问题