Today, I created an app, which collects name and surname from the user and we can store them as a file and retrieve when needed. This topic included fileinput and output stream.
To store it, we use FileOutputStream “name” = openFileOutput(“Filename”, access_mode); . After creating the file, to open it, we want to use OutputStreamWriter by passing the “name” of the path we created.
To retrieve the data, We use BufferedReader. To check the existance of file we use. File file = getApplicationContext().getFileStreamPath(“Filename”);
Then after reading the file, In order to get a specific data, we use StringTokenizer. This requires two arguements, one is the complete string which holds it and the next is on which parameter the data has to be seperated. For example the first line contains Chandru,Ravi. the comma(,) is the one which seperates it.