Java 将项目添加到资源文件

Java 将项目添加到资源文件,java,android,spinner,add,programmatically,Java,Android,Spinner,Add,Programmatically,如何以编程方式将项添加到spinner的字符串数组的strings.xml中 <Spinner android:id="@+id/tags" android:spinnerMode="dialog" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout

如何以编程方式将项添加到spinner的字符串数组的strings.xml中

<Spinner
            android:id="@+id/tags"
            android:spinnerMode="dialog"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            android:entries="@array/tags" />    

strings.xml

<string-array name="tags">
    <item>item1</item>
    <item>item2</item>
    <item>item3</item>
    <item>item4</item>
</string-array>>

项目1
项目2
项目3
项目4
>

您不能以编程方式向应用程序资源添加数据。资源是编译、打包和签名的APK包的一部分,因此不能修改。
您试图实现什么目标?

您无法以编程方式向应用程序资源添加数据。资源是编译、打包和签名的APK包的一部分,因此不能修改。
您试图实现什么目标?

您不能以编程方式向资源中添加内容。但是微调器不需要离开资源文件。使用内存中的项目列表,并对其进行修改。

您不能以编程方式将内容添加到资源中。但是微调器不需要离开资源文件。使用内存中的项目列表,并对其进行修改。

如果尝试以编程方式在微调器中添加数据

只有一种方法可以使用像#firebase这样的数据库来更新实时数据


“没有数据库是不可能的。”

如果尝试以编程方式在微调器中添加数据

只有一种方法可以使用像#firebase这样的数据库来更新实时数据

“没有数据库,这是不可能的。”

可能重复的可能重复的