我正在尝试从 Messages 文件夹中获取附件内容。但它显示的是空字符串,尽管它正确地返回了名称和大小。对于每个文件(txt、html 或其他),它不会返回任何字符串值。为此,我正在编写以下代码:
public boolean supports(String contentType)
{
boolean val;
if (contentType.toLowerCase().indexOf("txt") != -1)
{
val = true;
}
else
val = false;
return val;
}
public void run(Message m, SupportedAttachmentPart p)
{
MainScreen view = new MainScreen();
view.setTitle("Attachment Viewer");
view.add(new RichTextField(new String((byte[])p.getContent())));
view.add(new RichTextField(new String(p.getFilename())));
// PasswordScreen pwd = new PasswordScreen();
Logger.out("eMailMinderApp", "Attachment Content" +new RichTextField(new String((byte[])p.getContent())));
Ui.getUiEngine().pushGlobalScreen(view, 1, UiEngine.GLOBAL_QUEUE);
}
任何人都可以帮我解决这个问题..因为我从前两天被困在这里..