View Single Post
Old 08-11-2008, 10:05 AM   #5 (permalink)
Knows Where the Search Button Is
Join Date: May 2007
Location: indonesia
Model: 8800
Carrier: vodafone
Posts: 21
Post Thanks: 0
Thanked 0 Times in 0 Posts

Originally Posted by simon.hain View Post
add the attachment handler in an autorun part of your project (see kb article), your second assumption is correct, the system needs to know the filetype to be able to deliver a SupportedAttachmentPart.

Be aware of Attachments not supporting hasMore().
thanks for your attention.

My application is not an autostart app.
I create app that when it executed, it will waiting for FolderEvent,
I already successful while getting Multipart from Event's Message.

i already change my filename to: x-rimdevice-filename.ext
so the attachment will store in handheld (right?).

and its content-type is: application/x-myapp

I add AttachmentHandler in my appMainScreen constructor,
            public appMainScreen() {
            ah = new ahandler();
            //Add this AttachmentHandler to the AttachmentHandlerManager
            ahm = AttachmentHandlerManager.getInstance();
this is my inner class:
        class ahandler implements AttachmentHandler {
            public void run(Message m, SupportedAttachmentPart sap) {
                //Perform required processing on your attachment here.
                //Get the attachment filename.
                System.out.println("Filename: " + sap.getFilename());
                //Get the attachment size.
                System.out.println("Attachment size is: " + sap.getSize());
            public String menuString() {
                return "View ATT";
            public boolean supports(String s) {
                boolean b = false;
                if (s.toLowerCase().indexOf("myapp") != -1) {
                    b = true;
                return b;

when i get BodyPart from Multipart (my attachment on index number 1),
the bodypart's size is 0.
but return true on method bodypart.hasMore().

is it any error on my attachment handler registration?
because when i check into the message,
and press menu on message's attachment, the menu "View ATT"
is not shown.

any other clue?

Offline   Reply With Quote