当我将此代码放在onCreate()
方法中时,我的应用程序总是崩溃。请帮忙。
File dir = Environment.getExternalStorageDirectory();
File file = new File(dir, "Gest_val.csv");
String val1 = new String();
try {
Scanner inputStream = new Scanner(file);
while (inputStream.hasNext()) {
String data = inputStream.next();
if (data.equals("+")) {
tvOrientation.setText("found +");
Modify_val.add(Integer.parseInt(val1));
val1 = null;
} else {
tvOrientation.setText("NO +");
val1 = data;
}
}
} catch (IOException e) {
}