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

前端 未结 11 1889
隐瞒了意图╮
隐瞒了意图╮ 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:06

    I have been looking for solution of this question for a while and found this one up and running, hope it helps.

    private BitmapDrawable bitmapDrawable;
    private Bitmap bitmap1;
    //write this code in your share button or function
    
    bitmapDrawable = (BitmapDrawable) mImageView.getDrawable();// get the from imageview or use your drawable from drawable folder
    bitmap1 = bitmapDrawable.getBitmap();
    String imgBitmapPath= MediaStore.Images.Media.insertImage(getContentResolver(),bitmap1,"title",null);
    Uri imgBitmapUri=Uri.parse(imgBitmapPath);
    String shareText="Share image and text";
    Intent shareIntent=new Intent(Intent.ACTION_SEND);
    shareIntent.setType("*/*");
    shareIntent.putExtra(Intent.EXTRA_STREAM,imgBitmapUri);
    shareIntent.putExtra(Intent.EXTRA_TEXT, shareText);
    startActivity(Intent.createChooser(shareIntent,"Share Wallpaper using"));
    

提交回复
热议问题