How to attach a Bitmap when launching ACTION_SEND intent

后端 未结 4 1043
無奈伤痛
無奈伤痛 2020-12-05 00:44

I have this code:

 Intent intent = new Intent(); 
 intent.setAction(Intent.ACTION_SEND); 
 startActivity(intent); 

Which will successfully

4条回答
  •  离开以前
    2020-12-05 01:22

    Try this it may help you:

    ByteArrayOutputStream bos = new ByteArrayOutputStream();  
    yourbitmapimagename.compress(CompressFormat.PNG, 0, bos);
    Intent intent = new Intent(); 
    intent.setAction(Intent.ACTION_SEND); 
    intent.setType("*/*"); 
    intent.putExtra(Intent.EXTRA_STREAM, bos.toByteArray());
    startActivity(intent); 
    

提交回复
热议问题