after some digging around and trial and error i've found that the method that i posted above is fine, but theres another part of the application that isnt working properly. i'll post it here and change the title of the thread if i can so that i dont clog up the board with more error help requests.
i think the problem with my app is now to do with the file reading. basically it should take a string from a text file of the form ". Latitude Longitude: 00112.7816 W" and chop it into 2 seperate strings, "5257.1222 N" and "00112.7816 W"
once again, this works fine on the wireless toolkit, but is causing my program to throw an error on the method that i have given above.
the method code is:
Code:
public void readFile() {
try {
FileConnection filecon = (FileConnection)Connector.open("file:///c:/nokia/images/positions.txt");
// Always check whether the file or directory exists.
// Create the file if it doesn't exist.
if(!filecon.exists()) {
filecon.create();
}
DataInputStream is = filecon.openDataInputStream();
fileString = is.readUTF(is);
is.close();
filecon.close();
} catch(IOException ioe) {
System.out.println("Error!!! " +ioe);
}
}
public void trimString(){
position1 = fileString.substring((fileString.length()/4), (fileString.length()/2));
position2 = fileString.substring(((3*fileString.length())/4), fileString.length());
}
these two methods are called when the application starts and the variables in them are all global public variables
why doesnt this work!?!