这很简单:我正在尝试使用Android的gmail应用程序创建一个电子邮件,就像你使用gmail共享内容一样。我不知道该怎么做。
答案 0 :(得分:2)
找到它:
procedure TfrmSendMail.CreateEmail(const Recipient, Subject, Content,
Attachment, Attachment2: string);
var
Intent: JIntent;
Uri: Jnet_Uri;
AttachmentFile: JFile;
begin
Intent := TJIntent.Create;
Intent.setAction(TJIntent.JavaClass.ACTION_SEND_MULTIPLE);
Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK);
Intent.putExtra(TJIntent.JavaClass.EXTRA_EMAIL, StringToJString(Recipient));
Intent.putExtra(TJIntent.JavaClass.EXTRA_SUBJECT, StringToJString(Subject));
Intent.putExtra(TJIntent.JavaClass.EXTRA_TEXT, StringToJString(Content));
AttachmentFile := SharedActivity.getExternalFilesDir
(StringToJString(Attachment));
Uri := TJnet_Uri.JavaClass.fromFile(AttachmentFile);
Intent.putExtra(TJIntent.JavaClass.EXTRA_STREAM,
TJParcelable.Wrap((Uri as ILocalObject).GetObjectID));
Intent.setType(StringToJString('vnd.android.cursor.dir/email'));
SharedActivity.startActivity(Intent);
end;