0

How to read and write strings in text file in android which is kept in raw folder and also how to clear contents of that file in android?

I have done this way and my "temp.txt" file is in /raw folder. But i am not getting any output in file. Also I am not getting any error for this.

       FileOutputStream fos = openFileOutput("temp", Context.MODE_APPEND);         
        fos.write("Example Text in a file".getBytes());
        fos.flush();
        fos.close();
krunal shah
  • 16,089
  • 25
  • 97
  • 143

2 Answers2

0

Try this one

Community
  • 1
  • 1
harshalb
  • 6,012
  • 13
  • 56
  • 92
0

Try to put file int /asset folder and then do operations

success_anil
  • 3,659
  • 3
  • 27
  • 31