| Reply | « Previous Thread | Next Thread » |
|
Hi,I'm using Wireless Toolkit to run the code that suppose to access and read the text file.However ,when run ,program throws an exception notifying that the file doesn't exist.I'm aware that the files should be stored in the root1 directory used by the emulator.And when i perform print out of all the subdirectories and files within the root ,the subdirectories are being discovered ,but the files are not.Does anyone know ,why is this happening????
|
|
Can you kindly post your code here? I did it and working fine. I think you did any mistake in the path.
BR Javed |
|
Maybe invalid path. Please post your code
|
|
Hi dimondat,
you can take a look at PDAPDemo demo shipped with Wireless Toolkit 2.x, since it contains a simple example of a File Browser accessing local files. Cheers, Pit |
|
Ya you can go through PDADemo of WTK. It is done upon FileConection Api and PIM Api.
|
|
I actually had something very strange going on.This morning it was working fine.Instead of the DefaultColourPhone folder,where root typically resides, everytime i ran the program it was creating a temp folder ,with temp root for each particular run of the program.When i copied files into that folder, everything was going fine.the path that i use in program is
FileConnection fc = (FileConnection)Connector.open("file:///root1/headline.txt", Connector.READ); I'll look at PDA demo,thanks for the advice |
|
yeah,here is the code that i use
public void showFile() { StringBuffer sb =new StringBuffer(1000); int i=0,num=0; String str =null; try { FileConnection fc = (FileConnection) Connector.open("file://localhost/root1/headline.txt", Connector.READ); if (!fc.exists()) { throw new IOException("File does not exists"); } InputStream is = fc.openDataInputStream(); while((num=is.read()) != -1){ char ch=(char) num; sb.append(ch);} str=sb.toString(); System.out.println(); is.close(); fc.close(); } catch (Exception e) { e.printStackTrace(); System.out.println(e.getMessage()); } } } |
|
Dimondat, just a question: do you see any file named "in.use" in your DefaultColorPhone folder?
Sometimes it happens that it is not correctly deleted after an emulator sessions, and so following uses of emulator are not able to use files and folders: this could be the reason why it creates a new temp root folder and it does not find your file in the standard root. At least, this happened to me sometimes :) Cheers, Pit |
|
"file://localhost/root1/headline.txt" looks strange. Try just "file:///root1/headline.txt". Be shure what you have "root1" folder.
|
| Reply | « Previous Thread | Next Thread » |
| Thread Tools | Search this Thread |
|---|---|
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| problem when importing from carbide c++ to vs 2003! | misfit.physics | Symbian Tools & SDKs | 12 | 2008-02-19 10:45 |
| Nokia 6101 Locked 2 TMobile Midlet can't access internet... | Jason Glass | Mobile Java Networking & Messaging & Security | 45 | 2007-11-14 03:19 |
| Error with makesis.exe and creating the .pkg file | gramya87 | Symbian Tools & SDKs | 7 | 2007-10-10 14:53 |
| 求助关于SDK平台变化后系统头文件出错的问题 | cxg1103 | Symbian | 3 | 2007-03-07 04:36 |
| How to append text in a text file in j2me | lovely_334801 | Mobile Java Networking & Messaging & Security | 2 | 2006-01-15 07:10 |