0

I'm trying to figure out how can i make a byte array from an image (or ImageView if you prefer) taken from PicturesService gluon plugin methods, to save it to my db, and then using that byte array to reconvert that byte array into an image to display it on the GUI when i need it.

I've already seen this similar question:

SwingFXUtils shows NoClassFoundError

But this is not my case.

Can anybody help me?

Thanks in advance

EDIT

I also checked the SO questione Jose Pereda posted in comments:

getPublicStorage("Pictures") lists no files

But now i have an outOfMemoryException on android. How can i do this avoiding outOfMemoryException?

FFdeveloper
  • 241
  • 3
  • 14
  • The question you referred already solves what you ask for. Can you elaborate on "this is not my case"? – José Pereda Jul 28 '17 at 09:07
  • It's not my case because of this reasons: "And now you want to save that image into a private/public storage location on your device." I don't want to save picture in the user phone, i want to save the picture in my db converting image taken from takePhoto() method or from loadImageFromGallery() method into byte array (i specifically need byte array). "Also you can use StorageService and getPublicStorage("Pictures"), and going through the directory you can retrieve the last file added" I don't need to retrieve image in this way, methods already returns the picture i want – FFdeveloper Jul 28 '17 at 10:47
  • In addiction, i don't know how to convert image taken this way (without knowing the format, if is "jpg", "png", ecc..) correctly in byte array, and then reconvert it into an image – FFdeveloper Jul 28 '17 at 10:48
  • Ok, my bad, I thought you were referring to this other [question](https://stackoverflow.com/questions/42038942/getpublicstoragepictures-lists-no-files/42052139#42052139) – José Pereda Jul 28 '17 at 10:51
  • I tried this solution but i have this exception: E/AndroidRuntime(27557): java.lang.OutOfMemoryError: Failed to allocate a 69222412 byte allocation with 16777216 free bytes and 64MB until OOM E/AndroidRuntime(27557): at java.util.Base64$Encoder.encode(Base64.java:262) E/AndroidRuntime(27557): at java.util.Base64$Encoder.encodeToString(Base64.java:315) Can you tell me why? – FFdeveloper Aug 01 '17 at 08:17
  • Try increasing the heap memory. See the [documentation](http://docs.gluonhq.com/javafxports/#_android_4). – José Pereda Aug 07 '17 at 10:58

0 Answers0