1 Reply Latest reply: Oct 19, 2012 5:12 PM by Joe Huang-Oracle RSS

    Camera/picture convert to byte array

      The documentation says og camera destination type:

      DeviceManager.CAMERA_DESTINATIONTYPE_DATA_URL (0) - Returns the image as a Base64-encoded string. This value is also specified as an enum using DeviceManager.CAMERA_DESTINATION_DATA_URL when used programmatically.

      It does note return the image as a string, it return the image path.

      When i try to read that path with java.io.file it gives me a FileNotFoundException.

      I want to put the picture in the sqllite db, therefore i need to convert the image to a blob (byte array).

      How do i get a byte array in java with the camera functionality.

        • 1. Re: Camera/picture convert to byte array
          Joe Huang-Oracle
          Hi, the easiest way to work with images is to process them as base 64 string. You can store the image as a string in the local SQLite database, and then send it to server as needed. You can also display the image in Base64 string on client by simply set the source of the string = the EL expression that returns this base 64 string. ADF Mobile would automatically convert and display it.

          The main drawback with Base 64 is that the image size/quality cannot be too large. There is no specific rule of thumb yet, but you may want to watch out for out of memory errors. If you do, you would have to increase the JavaME memory allocation set in cvm properties file. This switch is enabled in the GA version of ADF Mobile.


          Joe Huang