Hi Forum,
I am new to Blackberry development (I am using Eclipse with Blackberry plug-in), I am trying to read a text file, which I placed in the "src" folder of my Blackberry project and this text file just contain a word "Test". when I run the program, I gets "UncaughtException: java.lang.outofmemoryerror". Here is the code I am using, where "speech.txt" is the file I am trying to read and is placed in the "src" folder -
public class SpeechMain extends MainScreen {
public SpeechMain() {
try {
Class myClass = this.getClass();
InputStream is = null;
is = myClass.getResourceAsStream("speech.txt");
InputStreamReader isr = new InputStreamReader(is);
char c;
while ((c = (char)isr.read()) != -1) {
add(new LabelField("" + c));
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
add(new LabelField(e.getMessage()));
}
}
}
Thanks in advance.
Thanks, Nikesh