I started writing a notepad for Android in Java, and I was interested in how to save and open notes in a notepad.
1 answer
Reading from file:
BufferedReader reader = new BufferedReader(new FileReader(fileName)); FileReader - read characters from a file.
BufferedReader - used to buffer the stream.
Write to file:
FileWriter fileWriter = new FileWriter(fileName); fileWriter can pass a whole string to fileWriter (it will automatically break into characters).
Here is a good lecture on this topic.
|