I am trying to write a basic \"notepad\" app for a school project.
I have created the main class with an editText
which I save as String
te
An example of how to use openFileInput:
FileInputStream in = openFileInput("filename.txt");
InputStreamReader inputStreamReader = new InputStreamReader(in);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
StringBuilder sb = new StringBuilder();
String line;
while ((line = bufferedReader.readLine()) != null) {
sb.append(line);
}
inputStreamReader.close();
The first parameter is the name of the file you are creating/updating when using openFileOutput method. Using the same parameter you have listed above it might look like:
FileInputStream fis = openFileInput(textOutput);
As for reading from a FileInputStream that is extremely well documented here and on the web. The best way to go about it also depends on the type of file you are reading (e.g. XML). So i will leave that for you to search on.
Edit: Here is documentation