可能重复:
android 从文本文件中读取
所以我需要加载文本,但我不知道如何:( 为了保存文本,我正在这样做
File logFile = new File("sdcard/data/agenda.file");
if (!logFile.exists())
{
try
{
logFile.createNewFile();
}
catch (IOException e)
{
e.printStackTrace();
}
}
try
{
//BufferedWriter for performance, true to set append to file flag
BufferedWriter buf = new BufferedWriter(new FileWriter(logFile, true));
buf.append(editText1.getText());
buf.newLine();
buf.close();
}
catch (IOException e)
{
e.printStackTrace();
}
那么,如何通过点击按钮将其加载回来?