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
New Developer
New Developer
LNO
Posts: 2
Registered: ‎11-05-2008
My Device: Not Specified

ClassCastException thrown invoking Message application on OS 4.3

The following example works on 4.2.1 simulators and devices, and 4.5 and 4.6 simulators (with warnings about the attachment type, though it will view the attachment), but on 4.3 simulators it throws a ClassCastException from within a class called "SMSComposeVerb". I see it occur on both the 8330 and 8130 simulators and I have reports of the bug manifesting on an 8300 series device. In fact, it seems to occur even without the attachment. Is this a known issue and is there a work-around?

 

Message message = new Message();
message.setFrom(new Address("me@bogus.domain", ""));
message.addRecipient(Message.RecipientType.TO, new Address("you@bogus.domain", ""));
message.setSubject("This is the subject.");
Multipart parts = new Multipart();
parts.addBodyPart(new TextBodyPart(parts, "This is the message body."));
SupportedAttachmentPart part = new SupportedAttachmentPart(parts);
part.setContentType("text/plain");
part.setFilename("foo.txt");
part.setContent("This is an attachment.".getBytes("US-ASCII"));
parts.addBodyPart(part);
message.setContent(parts);
Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES, new MessageArguments(message));

 

 

 

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: ClassCastException thrown invoking Message application on OS 4.3

I've also seen this issue on the various 4.3 simulators. For some reason, the simulators are lauching the SMS application rather than the Message application when using Invoke(). This is what triggers the cast exception.

 

AFAIK, the problem does not exist on the actual 4.3.0.xx levels that are out in the field. The only work-around that we have is to not test applications on 4.3 simulators if they require Invoke() on the Message application.

 

Please use plain text.