private void monthlyInput() throws IOException {
File inFile = new File(Environment.getExternalStorageDirectory ().getAbsolutePath(), "S050213.txt");
String data = inFile.getAbsolutePath();
TextView testData = (TextView) findViewById(R.id.textView1);
testData.setText(data);
FileInputStream fInStream = new FileInputStream(inFile);
BufferedReader myReader = new BufferedReader(new InputStreamReader(fInStream));
String data2 = myReader.readLine();
TextView testData2 = (TextView) findViewById(R.id.textView2);
testData2.setText(data2);
myReader.close();
}
我知道这是在查找文件,因为 data 正在输出正确的文件路径,但 data2 似乎为空。我最好的猜测是它没有找到文件
FileInputStream fInStream = new FileInputStream(inFile);
我想知道我哪里出错了,或者我是否离我应该去的地方很近。