I save the image to an xml file. For this, I initially convert the Bitmap into a byte array.
Bitmap bitmapSave = MediaStore.Images.Media.getBitmap(getContentResolver(), uriSave); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bitmapSave.compress(Bitmap.CompressFormat.JPEG, 100, stream); byte[] b = stream.toByteArray(); Then I pound this array into a line and get the following value: [B@59710c4
`org.w3c.dom.Element photo = doc.createElement("photo"); photo.appendChild(doc.createTextNode(b.toString())); photosElement.appendChild(photo); stream.close(); Then I save this xml file to a folder, etc.
And now loading: I receive value which I received from byte array, I receive everything as it should [B@59710c4
String strLoad = elementsLoad.get(i).text(); Next I get to the array from byte's string
byte[] imgBytes = strLoad.getBytes(); It would seem that everything, but the problem is that the array is very small compared to the original one, and when I get a Bitmap and assign it to an ImageView, the ImageView turns white. Ie assigned a white picture.
Bitmap bitmap = BitmapFactory.decodeByteArray(imgBytes, 100, imgBytes.length);
[B@59710c4. In general, I would recommend in xml to save an encoded base64 array of bytes, if you really really need. And ideally, do not store binary data in text format. - Alekcvp