aspose file tools*
The moose likes Java Micro Edition and the fly likes how to read and write images from and to  phone memory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "how to read and write images from and to  phone memory" Watch "how to read and write images from and to  phone memory" New topic
Author

how to read and write images from and to phone memory

sankar ganesh
Greenhorn

Joined: Jun 07, 2005
Posts: 20
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

Joined: Jun 05, 2005
Posts: 19
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

Joined: Jun 07, 2005
Posts: 20
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

Joined: Jun 05, 2005
Posts: 19
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.
 
jQuery in Action, 2nd edition
 
subject: how to read and write images from and to phone memory