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
Blazej
Posts: 15
Registered: ‎08-14-2008
My Device: 8300 with 4.5.0.52 b75 OS

How to create new inbox mail with attachment

[ Edited ]

Hi, I want to create inbox message with attachment .doc. I came to this code (using hints from this forum):

 

  Message msg = new Message();

 try {          
            msg.addRecipient(Message.RecipientType.TO, new Address("blazej@test.biz", "BlazejUsingBB" ));
        } catch(MessagingException e) {
            System.out.println(e.toString());


        }

msg.setSubject("This is subject" ) ;

 Multipart multipart = new Multipart();
        SupportedAttachmentPart attach = new SupportedAttachmentPart( multipart, "application/msword",  "document.doc", "sample data - other in use" );
        multipart.addBodyPart(attach);

 

 try
        {
          msg.setContent(multipart);
          msg.setSentDate(new Date());
          msg.setStatus(Message.Status.RX_RECEIVED, 1);
          msg.setFlag(Message.Flag.REPLY_ALLOWED, true) ;
          msg.setInbound(true);
          inbox.appendMessage(msg);
          msg.updateUi();
        }
        catch(MessagingException e)
        {
          System.out.println(e.toString()) ;
        }

 

This would create nearly perfect inbox message, with correct icon, updated the counter of new messages, attachment is in the message, also with 'open attachment' choice in the menu.

 

The problem is:  I have Doc2Go installed on my BB (8300, running 4.5.0.52 b75). After choosing to open this attachment, Doc2Go is running, but the attachment is not opened, the Doc2Go just displaybrowser with files on computer.

 

Somebody can help me with this? I'm really stucked here and also tired of trying without success. :smileysad:

 

Thanks for any hints.

Message Edited by Blazej on 09-03-2008 11:03 AM
Message Edited by Blazej on 09-03-2008 04:19 PM
Message Edited by Blazej on 09-03-2008 04:21 PM