简体   繁体   中英

Add new values to existing resource array

I have a res/values String-array that I would like users to be able to add new elements to via a form. I saw a post from 2011 that asked this question ( How to update arrays in res/values/array.xml by code? ) however, the answer stated that resource arrays are read-only at run time. I was wondering if anything has changed since 2011 that would allow users the ability to update the resource array (add new strings to it).

Unfortunately resource values are still immutable. They are generated when your project is compiled and overriden on every compilation. There is a corresponding warning here in the documentation: https://developer.android.com/guide/topics/resources/accessing-resources.html

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