Ok, there is no way that this is as hard as I'm making it out to be.
my.txt has only one line in it that says "this is the first line".
I have tried reading the docs and writing my own code and I've tried 15 other examples that I've found on the internet and in books, nothing seems to work.
Code:
FileConnection fconn = null;
InputStream inputStream = null;
StringBuffer sb = new StringBuffer();
String filePath = "file:///SDCard/newFolder/my.txt";
try {
fconn = (FileConnection)Connector.open(filePath);
inputStream = fconn.openInputStream();
InputStreamReader isr = new InputStreamReader(inputStream);
char c;
while ((c = (char)isr.read()) != -1) {
sb.append(c);
}
return sb.toString();
} catch(Exception ex) {
return "problem";
}
}
The path is correct, my.txt was created by another piece of code in the program.