image attachment to a mail.. how in android?

前端 未结 1 622
轻奢々
轻奢々 2020-12-02 01:32

i can pick a image and its path using intent. with the use of that path of an image. i have to set that image as attachment of the mail\'s body content. how its possible in

相关标签:
1条回答
  • 2020-12-02 01:58
    Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,getResources().getString(R.string.emlSendToFriendSubject));
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL,new String[]{emailto});
    emailIntent.setType("text/plain");
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT,getResources().getString(R.string.emlSendToFriendBody));
    File file = getFileStreamPath(EMAIL_TEMP_FILE);
    emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    emailIntent.setType("image/jpeg");
    emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+file.getAbsolutePath()));
    startActivityForResult(Intent.createChooser(emailIntent, getResources().getString(R.string.btnSendToFriend)),ActMain.EMAIL_DONE);
    
    0 讨论(0)
提交回复
热议问题