Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
arindamhit
Posts: 270
Registered: ‎12-24-2010
My Carrier: Airtel
Accepted Solution

Need Help For Download the attachment from Mail Client

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.

Please use plain text.
Administrator
MSohm
Posts: 14,065
Registered: ‎07-09-2008
My Carrier: Bell

Re: Need Help For Download the attachment from Mail Client

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.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
arindamhit
Posts: 270
Registered: ‎12-24-2010
My Carrier: Airtel

Re: Need Help For Download the attachment from Mail Client

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??



Please use plain text.
Developer
arindamhit
Posts: 270
Registered: ‎12-24-2010
My Carrier: Airtel

Re: Need Help For Download the attachment from Mail Client

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.

Please use plain text.