Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
rakesh86shankar
Posts: 1,003
Registered: ‎05-22-2009
My Device: Not Specified

File not found Exception on reading the imagefile

Hello Guys,I tried reading the file from SDCard in simulator,it shows the following error

 

Output from console:

 

file:///SDCard/BlackBerry/Picturesdefault360x480.png:::::::::::::::::::::::::::::::::::filePathSel::::::::::smileyembarrassed:>>>>>>>>>>>>
No stack trace
am herenet.rim.device.api.io.file.FileIOException: File not found

 

 

 

what could be the problem?

 

 

Regards

 

Rakesh Shankar.P

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Device: 9800

Re: File not found Exception on reading the imagefile

[ Edited ]

try this path

 

file:///store/home/user/pictures/default360x480.png

 

better way is 

 

String path = System.getProperty("fileconn.dir.memorycard")+"home/user/pictures/default360x480.png";

 

or

 

String path = System.getProperty("fileconn.dir.memorycard.photos")+"default360x480.png";

 

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: File not found Exception on reading the imagefile

Are u simulate the SDCard from the simulator

------------------------------------------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.

Please use plain text.
Developer
rakesh86shankar
Posts: 1,003
Registered: ‎05-22-2009
My Device: Not Specified

Re: File not found Exception on reading the imagefile

Yes,i am trying it in simulator,while checking as

 

 

System.out.println("File is"+imageFile.fileSize()); ---------------------->value i get as -1.

 

 

Is the Path not set properly?

 

Path i used  ---System.getProperty("fileconn.dir.photos")+selectedImage;

 

 to access the folder E:\RakeshSDCard\BlackBerry\pictures

 

 

Regards

 

Rakesh Shankar.P

 

 

 

Please use plain text.
Developer
nitinverma274
Posts: 950
Registered: ‎06-22-2010
My Device: 9550

Re: File not found Exception on reading the imagefile

I Mean that,

If you are trying in the Simulator

then You have to go to in Simulator Menu-->Change simulate path-And Browse and set the path here.

First

and in the code

Path should be

path= "file:///SdCard/File.png";

------------------------------------------------------------------------------------
Press Kudo to say thank to developer.
Also Press the Accept as solution Button when u got the Solution.

Please use plain text.
Developer
vivart
Posts: 147
Registered: ‎08-27-2010
My Device: 9800

Re: File not found Exception on reading the imagefile

 

 fileconn.dir.photos will return Default directory for storing pictures on device memory not the path of sdcard.

 

 

Please use plain text.