BlackBerry Forums Support Community
              

Closed Thread
 
LinkBack Thread Tools
Old 10-09-2007, 02:53 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2006
Location: shanghai
Model: 8700G
Carrier: china mobile
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default [HELP] How to get attachment content of a message

Please Login to Remove!

'm developing an application which wants to read an attachment of a message.

Following is the code:

class ReadEmailAttachment implements AttachmentHandler {
public static void main(String[] args) {
AttachmentHandlerManager.getInstance().addAttachme ntHandler(new ReadEmailAttachment());
}

public boolean supports(String contentType) {
return (contentType.toLowerCase().indexOf("xxl") != -1 ? true : false);
}

public String menuString() {
return "View XXL File...";
}

public void run(Message m, SupportedAttachmentPart p) {
Object obj = p.getContent();
String content = new String((byte[]) obj);
MainScreen view = new MainScreen();
view.add(new LabelField("Attachment Viewer"));
view.add(new RichTextField(text));
UiApplication.getUiApplication().pushModalScreen(v iew);
}
}

when there is a *****.XXL file attahcment in the message, "View XXL File..." is in the menu.
I try to click the menu item "View XXL File...", there is nothing to read.
The variable "obj" is type of "byte[0]" !!!

How can i read the attachment's content of an message?
Offline  
Old 10-09-2007, 08:46 PM   #2 (permalink)
Knows Where the Search Button Is
 
Join Date: Nov 2006
Location: shanghai
Model: 8700G
Carrier: china mobile
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

It's resolved. The attachment's filename is not correct.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Vintage GEM Cleveland, OH, U.S.A. Micrometer Gauge in case (K53)
$24.99
Vintage GEM Cleveland, OH, U.S.A. Micrometer Gauge in case (K53) pictureVINTAGE GLOBE BRASS FIRE SPRINKLER HEAD - N.R.
$9.99
VINTAGE GLOBE BRASS FIRE SPRINKLER HEAD - N.R. pictureVtg. Starrett No. 474 Screw Pitch Gage With Locking Device Mechanist Tool
$25.0
Vtg. Starrett No. 474 Screw Pitch Gage With Locking Device Mechanist Tool  pictureVtg. Starrett Dial Indicator No. 196B ITB Machinist Tool
$50.0
Vtg. Starrett Dial Indicator No. 196B ITB Machinist Tool pictureWW2 VTG U.S. NAVY STRUTHERS DUNN 746 119A RELAY 110 VOLT - N.R.
$9.99
WW2 VTG U.S. NAVY STRUTHERS DUNN  746 119A  RELAY 110 VOLT - N.R. picture






Copyright 2004-2016 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.