Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 图片作为电子邮件附件_Android_Iphone_Cordova - Fatal编程技术网

Android 图片作为电子邮件附件

Android 图片作为电子邮件附件,android,iphone,cordova,Android,Iphone,Cordova,我想建立一个应用程序,我可以附加一个电子邮件图像,打开图像,并设置为我的壁纸。我想让它跨平台运行,那么您能告诉我是否可以使用phonegap,或者我是否必须为iphone和android构建本机应用程序吗?您好,如果您只想通过电子邮件附加您的图像,那么使用此代码您就可以做到这一点 ArrayList<String> str = new ArrayList<String>() ; ArrayList<Uri> uris = new ArrayList<Ur

我想建立一个应用程序,我可以附加一个电子邮件图像,打开图像,并设置为我的壁纸。我想让它跨平台运行,那么您能告诉我是否可以使用phonegap,或者我是否必须为iphone和android构建本机应用程序吗?

您好,如果您只想通过电子邮件附加您的图像,那么使用此代码您就可以做到这一点

ArrayList<String> str = new ArrayList<String>() ;
ArrayList<Uri> uris = new ArrayList<Uri>();

//convert from paths to Android friendly Parcelable Uri's
for(int i=0; i<ayy_Images.size(); i++)
{
   if(ayy_Images.get(i) == null)
    {
       str.add("");
    }
    else
    {
       str.add(ayy_Images.get(i));
    }
}

for (String file : str)
{
   File fileIn = new File(file);
   Uri u = Uri.fromFile(fileIn);
   uris.add(u);
}

startActivity(Intent.createChooser(new Intent(Intent.ACTION_SEND_MULTIPLE).setType("audio/wav").setType("image/jpeg").setType("message/rfc822")
                            .putExtra(Intent.EXTRA_EMAIL, emails)
                            .putExtra(Intent.EXTRA_SUBJECT, subject)
                            .putExtra(Intent.EXTRA_TEXT, strDetails).putExtra( android.content.Intent.EXTRA_STREAM, uris), "Send your email in:"));             
ArrayList str=new ArrayList();
ArrayList URI=新的ArrayList();
//从路径转换为Android友好的包裹Uri

对于(int i=0;i对于iPhone sdk,您将图像附加为:

NSData *photoData = UIImageJPEGRepresentation([UIImage imageNamed:@"anImage.png"], 1);
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
[picker addAttachmentData:photoData mimeType:@"image/jpg" fileName:[NSString stringWithFormat:@"image001.png"]];
对于“打开图像并将其设置为“我的壁纸”

这不可能通过iPhone中的代码实现。您必须使用Settings.app