08-06-2013 08:49 AM
I am saving the data persistently.
I am getting bytes of image and i will convert it into Bitmap.
But the problem is i don't know how to save the image inn persistent memory??
Solved! Go to Solution.
08-07-2013 12:02 AM
Hi thanks for the reply
I have saved the bytes of the image that i am getting form server. But the problem is i have to display the image to the BitmapField everytime i made changes.
I am taking the image either form the gallery or capturing through camera.
data.put("Image", path1); //path1 is the bytes that i am getting after changing the image
I am just facing the problem in displaying the image .
08-07-2013 01:54 AM
Where are you facing the issue? Is that for creating bitmap from byte array? If yes, the below code will help.
Bitmap.createBitmapFromBytes(bytesArray, 0, bytesArray.length(), 1);
08-07-2013 01:57 AM
How you are converting this bytes to images back.
What is problem you are facing in showing images.
I did it by creating a class and setMethod(byte ) on its object and store this object in persistence and then getMethod that returns the byte and show image.
EncodedImage image = EncodedImage.createEncodedImage(
responseData, 0, responseData.length); here responseData is byte array.
Bitmap bitmap = image.getBitmap();
08-07-2013 02:13 AM
See i am getting the path1 as bytes as i have already mentioned in my code..I am getting the image from the conectServerForImage method..
public static Bitmap connectServerForImage(String url)
HttpConnection httpConnection = null;
DataOutputStream httpDataOutput = null;
InputStream httpInput = null;
Bitmap bitmp = null;
httpConnection = (HttpConnection) Connector.open(url+String);
if (responseCode== HttpConnection.HTTP_OK)
httpInput = httpConnection.openInputStream();
InputStream inp = httpInput;
byte b = IOUtilities.streamToBytes(inp);
EncodedImage hai = EncodedImage.createEncodedImage(b, 0, b.length);
throw new IOException("HTTP response code: " + responseCode);
catch (Exception ex)
System.out.println("URL Bitmap Error........" + ex.getMessage());
if (httpInput != null)
if (httpDataOutput != null)
if (httpConnection != null)
catch (Exception e)
The problem is i want after changing the data on the profile page i have saved them on persistent memory. Next time if i see the changes except image i get everything... I am saving the image in bytes form.
So i want to know how do i save the image in persistent memory so that next time if i made any changes any look back again. I can see the new image.
Is there any other method to do??