What I'm doing is working with a text document that I'm pulling numbers from a saved text document, each line has its own number, and it ignores any lines starting with a !, so, when using these codes, I am getting a NullPointerException and I'm not sure why, Its not filling the ArrayList because of this, how come?
try{
File f = new File(extStorageDirectory+"/data.txt");
FileInputStream fileIS = new FileInputStream(f);
BufferedReader buf = new BufferedReader(new InputStreamReader(fileIS));
String readString = new String();
integers.clear();
char check;
while((readString = buf.readLine())!= null){
check = readString.charAt(0);
if(check == '!'){
}
else{
//integers.add(0,Integer.parseInt(readString));
if(check == 0){
integers.add(0);
} else {
if(check == 1) {
integers.add(1);
} else {
if(check == 2){
integers.add(2);
}
}
}
}
}
} catch (Exception e) {
Toast.makeText(getApplicationContext(),"Find Data: "+e.toString(),Toast.LENGTH_LONG).show();
}