I have an image which needs to be sent to the server. Is there a way to convert a bitmap(jpg) to base64 string in blackberry?
What you request is a bit vague and odd, however I hope this can help:
With the following piece code it's possible to get a JPEG binary data for a Bitmap
(note, it is a compressed one, so the size of the data is as small as possible if compare to raw bitmap):
Bitmap bmp = ...; // your bitmap
int quality = 85;
EncodedImage encodedImg = JPEGEncodedImage.encode(bmp, quality);
byte[] data = encodedImg.getData();
Then you can encode it with Base64OutputStream
. See the API for sample code on how to encode.