0

I have a problem and Google couldn't help me :-(

I have the requirement to read an image from disk and send it through MMS. So my code goes like this:

in = new FileInputStream("/sdcard/phn/Images/D.jpg");
buf = new BufferedInputStream(in);
byte[] bMapArray= new byte[buf.available()];
buf.read(bMapArray);                
Bitmap bMap = BitmapFactory.decodeByteArray(bMapArray, 0, bMapArray.length);
image.setImageBitmap(bMap);//to display the image on UI

Now I am able to see the image which I just converted into bytes. The following code:

sms.sendDataMessage(phoneNumber, null, port, bMapArray, sentPI, deliveredPI);

throws an exception saying:

java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1253)
at android.os.Parcel.readException(Parcel.java:1235)

Why is sendDataMessage unable to read the array of bytes bMapArray? Please help !

Martin Buberl
  • 45,844
  • 25
  • 100
  • 144
Freecoder
  • 3
  • 2

1 Answers1

0

SmsManager.sendDataMessage() does not send MMS messages. By means of it you can send SMS message specifying raw data. NullPointerException you get might be related with http://code.google.com/p/android/issues/detail?id=3718 (data you pass it too long)

Try this: Android SDK MMS

Community
  • 1
  • 1
bart
  • 2,378
  • 2
  • 19
  • 21