How to show an image through an intent being compatible with different apps

前端 未结 4 918
Happy的楠姐
Happy的楠姐 2021-01-03 12:22

I\'m trying to share an image I have previously saved on disk, sending an Intent.ACTION_SEND. The problem is that I can\'t find a way to be compatible with diff

4条回答
  •  执念已碎
    2021-01-03 13:16

    this code is more easy

    Intent intent = new Intent(Intent.ACTION_SEND);
                intent.setData(Uri.parse("mailto:"));
                intent.putExtra(intent.EXTRA_EMAIL,"XXXXX@XXXX.com");
                intent.putExtra(intent.EXTRA_SUBJECT, "XXXXX");
                intent.putExtra(Intent.EXTRA_TEXT, "XXXXX");
                intent.setType("message/rfc822");
                chosser = Intent.createChooser(intent, "Enviar Email");
                intent.putExtra(intent.EXTRA_STREAM, uri);
                startActivity(chosser);
    

提交回复
热议问题