拍一张照片然后附上电子邮件

时间:2015-09-16 04:32:13

标签: android

我正在尝试拍照然后将其附加到电子邮件

这是我的代码:

Intent chupanh = new Intent();
    chupanh.setAction(MediaStore.ACTION_IMAGE_CAPTURE);

    File photoFile = null;
    try {
        photoFile = makephotofile();
    } catch (IOException ae) {
        ae.printStackTrace();
    }


    Uri urianh = Uri.fromFile(photoFile);
    chupanh.putExtra(MediaStore.EXTRA_OUTPUT, urianh);
    startActivityForResult(chupanh, Code_request);

有意图发送图像的代码

    Intent emailz = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:"
            + "osaka@gmail.com"));
    emailz.putExtra(Intent.EXTRA_SUBJECT, "subject");
    emailz.putExtra(Intent.EXTRA_TEXT, "text");

    File anhfile = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), fileplace);

    fileUri = Uri.fromFile(anhfile);
    emailz.putExtra(android.content.Intent.EXTRA_STREAM, fileUri);
    //
    startActivity(Intent.createChooser(emailz, "send email"));

但这只是发送照片名称。

我应该怎么做才能解决它?

感谢。

0 个答案:

没有答案