2012-02-02 59 views
0

我正在从用JavaMail API我的收件箱中的邮件我的Android应用程序,的Android阅读邮件用JavaMail API

是有可能“只是”有邮件正文以“content.toString()”?如果可能的话,我如何使用适配器查看邮件正文部分?我尝试过SimpleAdapter和SimpleCursorAdapter,但内容是一种Object,不适合适配器。

你提供什么?

谢谢。

private Message message; 
private Object content; 

message = inboxReader.inbox.getMessage(Integer.parseInt(_bundle.getString("RowId").toString())); 
content = message.getContent(); 

回答

2

也许你可以试试

private static String getMailContent(Multipart multipart) throws IOException, MessagingException{ 
    StringBuffer content = new StringBuffer(); 
    for (int i = 0; i < multipart.getCount(); i++) { 
     BodyPart bodyPart = multipart.getBodyPart(i); 
     String disposition = bodyPart.getDisposition(); 
     if (disposition != null && (disposition.equals(BodyPart.ATTACHMENT))) { 
       // ................................ 
     } else { 
      content.append(bodyPart.getContent()); 
     } 
    } 
    return content.toString(); 
}