2011-12-12 149 views
0

我想建立一个应用程序,我可以附上图像的电子邮件,打开图像,并将其设置为我的壁纸。我想让它跨平台,所以你可以告诉我,如果它可能使用phonegap或我必须建立一个本机应用程序的iPhone和Android?图像作为电子邮件附件

回答

0

你好如果你想只是电子邮件附上您的图像,然后使用这个代码,你可以做到这一点..

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:"));    

ayy_Images是包含图像列表中选择一个ArrayList中。

-1

对于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