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 !