简体   繁体   中英

read and write to a file in apk

There is a file strings.xml:

<?xml version="1.0" encoding="utf-8"?>
<string name="param">0</string>

need to read a variable named "param" and change it to another int variable
or read and write to a file located in this APK, for example /assets/config.txt?

Don't try to modify the APK.

You should consider using other "persistent storage" options for your Android application ... you don't really want to be modifying the contents of your APK on the device. Shared Preferences , External Storage or SQLite Databases are among the options you have. You may want to read more documentation about these options on the Android developer area here

You cannot write/modify file in assets folder runtime. Please check How to write files to assets folder or raw folder in android?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM