覆盖Android项目中assets文件夹中的textfile内容

mob*_*gic 1 android android-assets

我有一个counter.txt在我的Android项目的assets文件夹中命名的文件.在运行时,我想覆盖文件的内容.但它并没有反映出来.我该如何解决这个问题?

我使用了以下代码.

String FILENAME = "counter.txt";
String string = "hello world!";

FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();
Run Code Online (Sandbox Code Playgroud)

Lal*_*ani 5

据我所知,你不能write/updateassets文件夹中.你唯一能做的就是read.