I mean I want to append my txt in raw file.
I use this but it cant.
FileOutputStream fOut = openFileOutput(R.raw.a, MODE_WORLD_APPEND);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
I mean I want to append my txt in raw file.
I use this but it cant.
FileOutputStream fOut = openFileOutput(R.raw.a, MODE_WORLD_APPEND);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
Files in raw are packaged with ap. So these are read only files. You cannot modify these files. You need to copy this onto filesystem and then change it.
Edit: Check this post Copying raw file into SDCard? . Add permission
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
if you are writing to sdcard
I'm new to android programming, but what I think the problem is that you can't change the R.raw files. However, you should be able to write to an file on the device directly like this:
FileWriter f0 = new FileWriter("file1.txt");
f1.write("Hello Ersin!");
f1.close();
It should also be a lot easier to access and modify files made on the device instead of some created inside the project.