private void mWriteFile() {
try {
FileOutputStream fileOutputStream = openFileOutput("myfile.txt",
MODE_PRIVATE);
String writeString = "test";
fileOutputStream.write(writeString.getBytes());
} catch (FileNotFoundException e) {
Toast.makeText(getBaseContext(), "error"+e, Toast.LENGTH_LONG).show();
} catch (IOException e) {
Toast.makeText(getBaseContext(), "error"+e, Toast.LENGTH_LONG).show();
}
}
private void mReadFile(){
try {
FileInputStream fileInputStream;
fileInputStream = openFileInput("myfile.txt");
byte[] readBytes = new byte[fileInputStream.available()];
fileInputStream.read(readBytes);
String readString = new String(readBytes);
Toast.makeText(getBaseContext(), ""+readString, Toast.LENGTH_LONG).show();
} catch (FileNotFoundException e) {
} catch (IOException e) {
}
}