Принудительное закрытие при прямом открытии чтения файла активности
Я пытаюсь получить прямой доступ к этой активности, но принудительно закрыт:
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.log);
historyView = (TextView) findViewById (R.id.historyView);
String data = (String) getIntent().getExtras().get("data");
try { FileInputStream fin = openFileInput("data.txt"); InputStreamReader isr = new InputStreamReader(fin);
char[] inputBuffer = new char[data.length()];
isr.read(inputBuffer);
String readString = new String(inputBuffer);
boolean isTheSame = data.equals(readString);
historyView.setText(readString);
}
catch (FileNotFoundExceptione) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Однако это работает, когда я получаю к нему доступ из другого моего действия, которое пишет и передает data
над ним. Зачем? в чем проблема на самом деле?