BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 05-04-2009, 04:35 AM   #1 (permalink)
New Member
 
Join Date: Nov 2008
Model: 8310
PIN: N/A
Carrier: Developer
Posts: 2
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with getMIMEType() method of MessagePart class

Please Login to Remove!

I want to get the MIME type of message but unable to get the expected result. When i call getMIMEType() method it always return application/vnd.wap.mms-message but it shd be text/plain Or image/png or ... something like that .Moreover getMessageParts() method always return single element of MessagePart in the array also if the MMS contain more then one part in it. Can anybody tell me where i m wrong . i m trying the following code:



MultipartMessage msg =(MultipartMessage)o;

if (msg != null)
{
String senderAddress = msg.getAddress();

Dialog.alert("sender address: " + title + " " + senderAddress);

String subject = msg.getSubject();
Dialog.alert("subject: " + subject );
String date = msg.getTimestamp().toString();
Dialog.alert("Date: " + date );
MessagePart[] parts = msg.getMessageParts();
if (parts != null)
{
for (int i = 0; i < 1; i++)
{
MessagePart mp = parts[i];
//mp.
String mimeType = mp.getMIMEType();
//mimetype.
Dialog.alert("MIME Type: " + mimeType);
String contentLocation = mp.getContentLocation();
Dialog.alert("Location : " + contentLocation);
byte[] ba = mp.getContent();
if (mimeType.equals("image/png"))
{
Dialog.alert("im here");
try
{
Image image = Image.createImage(ba, 0, ba.length);
Dialog.alert("im here");
}
catch (IllegalArgumentException iae)
{Dialog.alert("IllegalArgumentException");}
} else if (mimeType.equals("image/gif")) { Dialog.alert("GIF Image" ); }
else if (mimeType.equals("image/bmp")) { Dialog.alert("BMP Image" ); }
else if (mimeType.equals("text/plain")) { Dialog.alert("Plain Text" ); }
else { Dialog.alert("Nothing." ); }
}

}
//}
}
I m using JDK 4.5 and Device Software version 4.5.... Kindly reply as soon as possible.
Regards,
Preeti
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

Ram Pinion for Bridgeport Mill
$19.0
Ram Pinion for Bridgeport Mill pictureHP t5745 Thin Client 1.66GHz, 2GB Flash 2GB Ram HP REFURB BOXED H1T61UC#ABA
$165.0
HP t5745 Thin Client  1.66GHz, 2GB Flash 2GB Ram HP REFURB BOXED H1T61UC#ABA picture1HP AP5000, POS SYSTEM, Intel Core 2 Duo CPU E7400 @ 2.80GHz, RAM 3GB, HDD 160GB
$389.99
1HP AP5000, POS SYSTEM, Intel Core 2 Duo CPU E7400 @ 2.80GHz, RAM 3GB, HDD 160GB pictureLenovo Thinkpad P50 Xeon E3-1505M 16GB RAM 256 SSD PCIe 500HDD Quadro M2000M
$1900.0
Lenovo Thinkpad P50 Xeon E3-1505M 16GB RAM 256 SSD PCIe 500HDD Quadro M2000M picture4GB SWISSBIT PC3200 ECC REGISTERED PC RAM MEMORY (4X1GB)
$22.99
4GB SWISSBIT PC3200 ECC REGISTERED PC RAM MEMORY (4X1GB)  picture






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