androidresourcesautocompletetextview

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


Solution

  • 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.