converting image to byte[] in cldc, midp2.0 devices

Hello Friends,

I need to convert a image to byte[] for sending an image to server. can anyone suggest me any solution. I am developing on MOTOROKR E 6 handset.

i have already searched whole net & even methods on this thread didn't help me.

http://forum.java.sun.com/thread.jspa?threadID=617676&tstart=120

The fuzz is that the mobile is running Linux OS & emulator started giving Null Pointer Exceptions when i tried to implement a few methods( i don't know why)

Also when i passed a static byte[] of captured image to connection thread it again yelled Null Pointer Exception.

I am sick of this mobile pulling my hairs since last 4 days. so plz help me

thanks a lot

Rahul

[740 byte] By [scientist.rahula] at [2007-11-27 10:36:16]
# 1

hi rahul!.

Well, i can't help you much...only a can tell you that the function

Image image.getRGB (...) in combation with a loop to transform a int[] to byte[] usign bit operations is the common idea of all this. If you are having and error with this i think is cuz or the emulator is wrong or maybe some other error... i never heard about problems with that funcion...but in j2me world every model and emulator have their thorns....how knows...

The only usefull observation i can make is: Maybe you are trying to save an image to big, and to have and int[] and byte[] at the same time in memory causes en out of memory exception. So try with a lighty image....

Hope that some of this help.

Cya!

Vituchina at 2007-7-28 18:40:15 > top of Java-index,Java Mobility Forums,Java ME Technologies...
# 2

Hi Vituchin ,

Thanks for replying

well i tried this method but my emulator crashed even with a very small image

see this

http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/java/p_java_0502.jsp

anyways thanks again

scientist.rahula at 2007-7-28 18:40:15 > top of Java-index,Java Mobility Forums,Java ME Technologies...