如何保存回的资产文件夹中的文件文件、资产、夹中

2023-09-05 08:17:14 作者:本是凉薄之人何必用情太深

我明白我可以打开的资产文件夹中的文件是这样的。

I understand I can open a file in assets folder like this.

InputStream is = ((Activity) mView).getAssets().open("some.txt");

不过,我应该怎么做才能挽救回同一个文件?我的意思是我怎么同一个文件中的OutputStream?

But what should I do to save back to the same file? I mean how do I get OutputStream of the same file?

推荐答案

根据我所知的不能,因为 /资产目录不写的,所以你不能对文件,该文件位于/资产目录中的任何变化,它由于Android的.apk文件只可读。

As per my knowledge you can't because /asset directory is not writeable, So you can't make any changes on file which are in /asset directory, Its because Android .apk file is only readable.

有关更多信息看这个讨论Writing到文件夹的资产与这太问题How将文件写入到资产的文件夹或原始文件夹中的android?

For more info look at this discussion Writing to file Assets folder And this SO question How to write files to assets folder or raw folder in android?