android2.3中,转发带附件的邮件时,新建的邮件中没有相应的附件。查看源码发现,确实没有相关实现,但貌似有实现的源码被注释掉了。求大体思路~~~~~
解决方案 »
- 谁有NDK开发的游戏源代码?
- 开发一个android程序,同时实现网页版,请问该用哪种通信方式呢?服务器端该用哪种语言?
- 关于PowerManager的问题
- 动态布局位置无效 求高手
- 请教一个小问题,关于选择sdk的
- 安卓音频混音
- android expandablelistview 高亮的问题。
- NOKIA OVI商城的应用程序审核过程?
- android图片下载问题
- android adapter里面怎么使用startActivityForResult()方法
- android导入spring的jar包后发生NoClassDefFoundError错误?
- 请教高手,通话中如何播放提示音,如分钟提示音
楼主可以做个参考:
File file = new File("\sdcard\android123.cwj"); //附件文件地址 Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra("subject", file.getName()); //
intent.putExtra("body", "android123 - email sender"); //正文
intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file)); //添加附件,附件为file对象
if (file.getName().endsWith(".gz")) {
intent.setType("application/x-gzip"); //如果是gz使用gzip的mime
} else if (file.getName().endsWith(".txt")) {
intent.setType("text/plain"); //纯文本则用text/plain的mime
} else {
intent.setType("application/octet-stream"); //其他的均使用流当做二进制数据来发送
}
startActivity(intent); //调用系统的mail客户端进行发送
/*******转发代码********/ if (!loadAttachments(message, 0)) {
mHandler.sendEmptyMessage(MSG_SKIPPED_ATTACHMENTS);
} private boolean loadAttachments(Message message, int depth){
try{
Attachment[] attachments = Attachment.restoreAttachmentsWithMessageId(this, message.mId);
for(final Attachment attachment:attachments){
mHandler.post(new Runnable() {
public void run() {
Uri aUri = Uri.parse(attachment.mContentUri);
addAttachment(aUri);
}
});
}
return true;
}catch(Exception ex){
ex.printStackTrace();
return false;
}
}