Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Contributor
Posts: 43
Registered: ‎07-22-2012
My Device: curve
My Carrier: syudent
Accepted Solution

Convert byte[] to bitmap

[ Edited ]

how convert byte[] to bitmap and convert bitmap to byte[] and when get image from server it return in String how parse this string to byte[] exmple in android it parse like this 

byte[] logoImg = Base64.decode(jLogo.getString(i), 0);

 thanks in advanced

New Contributor
Posts: 9
Registered: ‎07-27-2012
My Device: Z10 LE, 9900, Playbook, Dev Alpha
My Carrier: Orange

Re: Convert byte[] to bitmap

Hi there,

 

You can use the method  createBitmapFromBytes from the Bitmap Class to convert an array of bytes to a Bitmap. If you know the image will be in PNG format you can even use createBitmapFromPNG


API specification:

http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/system/Bitmap.html#createBitma...

 

http://www.blackberry.com/developers/docs/7.0.0api/net/rim/device/api/system/Bitmap.html#createBitma...