Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to read and write images from and to phone memory

 
sankar ganesh
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i'm developing one appln in j2me.in that i want to read and save images from and to phone memory.i already tried it with file connection api.File connection api supports only CLDC1.1 most of the mobile supports CLDC1.0
can u tell me a soln for this read and write.is there any other API to be used to make use of Fileconnection within CLDC1.0 itself
please anyone give me a soln.i'm in need of help very urgent please help
thanx a lot in advance
 
Maddi Ranjan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes u can do it using file connection api but ur devcice must be MIDP 2.0.

But there are some midp 2.0 device which are not support jsr-75, if the device support u can read write image from device.

for reading here is the code:

InputConnection fileConn = null;
DataInputStream dis = null;
fileConn =(InputConnection)Connector.open(file:///1.jpg,Connector.READ);
dis = fileConn.openDataInputStream();
now from this DataInputstream u can read image data.

For write first u create a blank image file then open it in write mode, nad place the data in output stream.
 
sankar ganesh
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Maddi,
thanx a lot.i think this will read and write images that r located in the resource folder itself and store the image in appdb it seems.
if i want to read the image file that is stored in phone memoryi.e.,where the images r stored which captured by the camere in the mobile then can u tell me the path to get that images and i wants to save the image back to that folder only.i struggling 4 this for the last one month.
ur reply'll be very helpful for me
thanx a lot
 
Maddi Ranjan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Camera images are by default store in storage/root1/ of WTK 2.0 default emulator. But for nokia it is different u can get it using this code System.getProperty("fileconn.dir.photos");
for WTK 2.0 path is file:///root1/

This path differ device by device....
So u go through the manual docs of the device.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic