11-15-2012 09:10 AM
Hi,
i am trying to download the attachment of the mail using AttachmentDownloadManager API . For this i am currently using the below code:
public class MailMinder extends UiApplication {
public static void main(String args[]) {
MailMinder theApp = null;
try {
theApp = new MailMinder();
} catch (Exception e) {
Dialog.alert("Exception e = " + e.toString());
} finally {
theApp.enterEventDispatcher();
}
}
private MailMinder() {
AttachmentDownloadManager adm = new AttachmentDownloadManager();
adm.download(bodypart, null, new DownloadProgressListener() { // Not able to get the Bodypart object here
public void downloadCancelled(Object element) {
}
public void downloadCompleted(Object element) {
//Here i am doing the parsing of the attachment
}
public void updateProgress(Object element, int current, int total) {
}
}
}
As you can check, the download() method of this API is required the Bodypart object which i have to get by using the message object of the opened Mail or Message.
But i am not able to get the message object of the opened message which i tried using MessageListener and FolderListener API. And when i am opening one Message in the Messages Application, i have to add one Menuitem.
Can any one help me to get the Message object of the opened Message and to add the Menuitem??
Note : I dont want to use the Attachment Handler API as it is require the prefix xirimdevice in the attachment name.
Solved! Go to Solution.
11-15-2012 10:23 AM
Have a look at the AttachmentDemo sample application included with the BlackBerry Java SDK for a complete example on the use of AttachmentDownloadManager. You can access it by choosing File -> Import -> BlackBerry -> Import BlackBerry Samples.
11-15-2012 10:44 AM
Thanks Mark. I checked already. But in this app, in the AttachmentAction class, it is trying to get the all messages and then getting the bodypart of the message. But for my case, i want the body part, for onley the opened message by the user. How can i implement that??
11-16-2012 08:40 AM
Hi Mark. I am able to resolve this issue with some different approach. Please check it in my blog: BlogforMobile
Thanks alot again for your support.