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
  • 15,753
  • 24
  • 94
  • 139

2 Answers2

0

Try this one

Community
  • 1
  • 1
harshalb
  • 5,952
  • 13
  • 55
  • 91
0

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

success_anil
  • 3,634
  • 3
  • 25
  • 31