0

I need to fetch image from MMS that having txt and image.

query.getString(cPart.getColumnIndex("ct"); 

...returns text/plain type.

Don't show image type.

Padma Kumar
  • 19,893
  • 17
  • 73
  • 130
Sankari
  • 53
  • 1
  • 7

1 Answers1

0

Each MMS message has multiple parts stored in the content://mms/part/ table. Some parts may be text, some may be images and other media types. Once you have the ID of the MMS you want to read, query all parts:

Cursor query = getContentResolver().query(Uri.parse("content://mms/part", null, "mid = " + mmsID, null, null);

If the MMS contains and image, it will have a part whose content type is an image type.

if(query.moveToFirst()) {
    do {
        String type = query.getString(query.getColumnIndex("ct"));
        if(type.equals("image/bmp") || type.equals("image/jpeg") || ...) 
            //Read the image
    while(query.moveToNext());
}

Look here for more information about reading MMSs.

Community
  • 1
  • 1
Jong
  • 9,045
  • 3
  • 34
  • 66
  • when i change this it shows complie error.. 'The method query(Uri, String[], String, String[], String) in the type ContentResolver is not applicable for the arguments (Uri, null, String[], null, null)' – Sankari Jul 11 '13 at 12:15
  • Yea... I passed a string array instead of a string. I'll change it. – Jong Jul 11 '13 at 12:45
  • ya. i already give that.. It only show the type as text/plain.. Not consider other part(image/jpg) – Sankari Jul 12 '13 at 04:52