Possible Duplicate:
android reading from a text file
So I need to load text, but I don’t know how 🙁 To save text I’m doing this
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();
}
So, how to load it back by button tap?
To read content of file, for example *.txt – do this…
Then, from activite to set to textview – just do smthing like