简体   繁体   中英

add string in resource in android

I have a String array in resource file

`

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <string-array name="countries_array">
        <item>Afghanistan</item>
        <item>Albania</item>
        <item>Algeria</item>
        <item>American Samoa</item>
        <item>Andorra</item>
        <item>Angola</item>
        <item>Anguilla</item>
        <item>Antarctica</item>
    </string-array>
</resources>

`

I want to add Name from my Database / for now think of from Activity.java file is there any way to do that?

I want to use them in my AutoCompleteTextView for HINT

You can't add things programatically to a resource. They're hard coded at compile time. What you can do is read in the resource, store it in a List, and then add to that.

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