"Image":{"Bytes":[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,3,140,0,0,4,157,8,2,0,0,0,132,133,69,69,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,4,103,65,77,65,0,0,177,143,11]}
byte[] data2 = (byte[]) tempImage.get("Bytes");
Image img = Image.createImage(data2, 0, data.length);
--
You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codenameone-discu...@googlegroups.com.
Visit this group at http://groups.google.com/group/codenameone-discussions.
To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/353f5fab-81b0-4dfa-a240-f2cf623f19ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
byte[] b = new byte[bytesList.size()];
for(int iter = 0 ; iter < b.length ; iter++) {
Object o = bytesList.get(iter);
if(o instanceof Double) {
b = ((Double)o).byteValue();
} else {
b = ((Long)o).byteValue();
}
}
Thanks Steve and Shai.I got it to work by combining your code with Steve's.
List bytesList = (List) tempImage.get("Bytes"); byte[] bytes = new byte[bytesList.size()]; for (int iter = 0; iter < bytes.length; iter++) {
Object o = bytesList.get(iter); if (o instanceof Double) {
bytes[iter] = ((Double) o).byteValue(); } else { bytes[iter] = ((Long) o).byteValue(); } }