0

For the past 3 hours I've been trying to write to a file in Andoid.

This is my latest attempt:

try {
    String text="alo";
    FileOutputStream fos=openFileOutput("gameProg.txt",Context.MODE_APPEND);
    fos.write(text.getBytes());
    fos.close();
} catch (IOException e) {
    e.printStackTrace();
}

I have also tried some FileWriter method that only leads to the read-only file system error. Apart from this FileOutputStream attempt, I have deleted several others which did not have an impact on the file. Is there any way that I could write to this file (without rooting my phone)?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Rares Amza
  • 83
  • 5
  • Does this answer your question? [android what is wrong with openFileOutput?](https://stackoverflow.com/questions/3625837/android-what-is-wrong-with-openfileoutput) – f1sh May 17 '22 at 18:13
  • Unfortunately it doesn't solve my issue – Rares Amza May 17 '22 at 18:46

0 Answers0