zoukankan      html  css  js  c++  java
  • 邮件转发附件无法转发

    在MessageCompose.java类中添加这两个方法:

                 private boolean findAttachmentWithMessageId(Context context,long messageId){
                   Uri uri =  ContentUris.withAppendedId(Attachment.MESSAGE_ID_URI,messageId);
            Cursor c = context.getContentResolver().query(uri,Attachment.CONTENT_PROJECTION,null,null,null);
            boolean allAttachmentsDownload = true;
            try{
                int count = c.getCount();
                for(int i = 0;i<count;++i){
                                   c.moveToNext();
                                   final Attachment attachment = new Attachment();
                           attachment.mFileName = c.getString(Attachment.CONTENT_FILENAME_COLUMN);
                                   attachment.mContentUri = c.getString(Attachment.CONTENT_CONTENT_URI_COLUMN);
                                   attachment.mSize  = c.getLong(Attachment.CONTENT_SIZE_COLUMN);
                                   attachment.mMimeType = c.getString(Attachment.CONTENT_MIME_TYPE_COLUMN);
                                   if(attachment.mContentUri == null){
                                   allAttachmentsDownload = false;
                                   continue;
                                   }
      
                                   mHandler.post(new Runnable(){
                                   public void run() {
                                           addAttachment(attachment);
                                           }
                                   });
                   }
                   }finally {
                           c.close();
                   }
                   return allAttachmentsDownload;
        }

           private boolean loadAttachments(Message message,Context context){
            return findAttachmentWithMessageId(context,message.mId);
           }

     

    在processSourceMessage()方法里面:else if(ACTION_FORWARD.equals(mAction))下
    if(!loadAttachments(message,MessageCompose.this)){
     mHandler.sendEmaptyMessage(MSG_SKIPPED_ATTACHMENTS);
    }这段代码放开。

     

    将MessagingController.java文件

       loadAttachment方法里面的:
       pruneCachedAttachments(accountId);注销掉

  • 相关阅读:
    在浏览器中输入URL后,执行的全部过程。会用到哪些协议?(一次完整的HTTP请求过程)
    线程的5种状态详解
    哈希表(Hash Table)原理及其实现 【转载】
    notify() 和 notifyAll() 有什么区别? wait()
    B树、B-树、B+树、B*树介绍,和B+树更适合做文件索引的原因 【转】
    pthread_join和pthread_detach的用法 【】转载】
    什么是进程?什么是线程
    进程间的五种通信方式介绍【转载】
    81. Search in Rotated Sorted Array II
    33. Search in Rotated Sorted Array
  • 原文地址:https://www.cnblogs.com/douzhanshen/p/Email_attachment.html
Copyright © 2011-2022 走看看