gpt4 book ai didi

android - 如何在 android sdk 中将图像和位置附加到电子邮件?

转载 作者:行者123 更新时间:2023-11-29 20:51:35 24 4
gpt4 key购买 nike

您好,我正在其中开发一个 Android 应用程序,我们可以拍照并将其发送到默认电子邮件,我使用 MeadiaStore.ACTION_IMAGE_CAPTURE 实现图像捕获);

我通过使用 location.getLatitude() 和 location.getLongitude() 获取位置;

然后如何将此图像和位置附加到电子邮件,例如 email.putExtra(Intent.EXTRA_SUBJECT,"subject");

最佳答案

首先你必须将捕获的图像存储在 sdcard 中,然后使用此代码发送电子邮件

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("application/image");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{strEmail});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Test Subject");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "From App");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/Myimage.jpeg"));
startActivity(Intent.createChooser(emailIntent, "Send mail..."));

关于android - 如何在 android sdk 中将图像和位置附加到电子邮件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29025454/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com