I am retrieving an image from my SQLite table and converting it to a byte array using this code :
byte[] imageByteArray = cImage.getBlob(cImage.getColumnIndex("ImageData"));
which works fine (I have proven this by decoding it back to the original image like this :
ByteArrayInputStream imageStream = new ByteArrayInputStream(imageByteArray);
Bitmap theImage = BitmapFactory.decodeStream(imageStream);
The problem I have is I need to serialise the image data and send it via .net web services, then decode it at the other end.
I am using this code to encode the byte[] to a Base64 string :
String sImageData = Base64.encode(imageByteArray);
Then adding it as a property to my service call.
The call takes a while to complete which indicates it is sending the data – although I get the exception “Value cannot be null” when I do this in the web service :
byte[] baImageData = Convert.FromBase64String(sImageData);
I’m not sure how I can debug this any further – am I missing something obvious?
it works fine, but if you send a long picture, it crash.
in Android:
In .net Webservice: