Read/Write String from/to a File in Android
Hope this might be useful to you. Write File: private void writeToFile(String data,Context context) { try { OutputStreamWriter outputStreamWriter = new OutputStreamWriter(context.openFileOutput(“config.txt”, Context.MODE_PRIVATE)); outputStreamWriter.write(data); outputStreamWriter.close(); } catch (IOException e) { Log.e(“Exception”, “File write failed: ” + e.toString()); } } Read File: private String readFromFile(Context context) { String ret = “”; try { InputStream inputStream = … Read more