I understand I can open a file in assets folder like this.
InputStream is = ((Activity) mView).getAssets().open("some.txt");
But what should I do to save back to the same file? I mean how do I get OutputStream of the same file?
Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml. Step 3 – Create a new Assets folder and write a new text file in it.
Standard users who are members of the Asset Library can also create asset files. From Files home, go to Libraries | Asset Library. Click Upload Asset File. The file selector opens to let you upload a new file or select an existing file to make into an asset.
The Assets folder is where you should save or copy files that you want to use in your project. The contents of the Project Window in Unity shows the items in your Assets folder.
In Android one can store the raw asset file like JSON, Text, mp3, HTML, pdf, etc in two possible locations: assets. res/raw folder.
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.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With