【问题标题】:how to attach image and location to email in android sdk?如何在 android sdk 中将图像和位置附加到电子邮件?
【发布时间】:2015-05-15 12:50:23
【问题描述】:

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

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

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

【问题讨论】:

    标签: android image email location


    【解决方案1】:

    首先,您必须将捕获的图像存储在 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..."));
    

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-12-29
    • 2012-11-19
    • 2019-01-21
    • 2012-03-28
    • 1970-01-01
    • 2010-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多