在Android中的strings.xml中编写

Fah*_*jua 0 java xml string android xml-serialization

我在一个Android应用程序上工作,我从JSON格式的服务器获得响应.我想将键值对存储在strings.xml中.怎么办呢?JSON响应如下.

 {
"ResourceStrings": [
    {
        "Key": "AccountNumber",
        "Value": "Account Number"
    },
    {
        "Key": "AccountPassword",
        "Value": "Account Password"
    },
    {
        "Key": "AccountSettings",
        "Value": "Account"
    },
    {
        "Key": "AccountSettings.Load.InfoMessage",
        "Value": "The Account Number and Password only needs to be set one time.  \r\n\r\nIf you do not know the Account information please contact you system administrator or your DataXchange reseller."
    },
    {
        "Key": "Add",
        "Value": "Setup"
    },
    {
        "Key": "AddandModifytheScreens",
        "Value": "Add and Modify the Screens"
    },
    {
        "Key": "AddButton",
        "Value": "Add"
    },
    {
        "Key": "AddButtonClick.InfoMessage",
        "Value": "Enter the new information and press the Enter button to save the changes.\r\n\r\nOr, press the Cancel button to discard the new information."
    },
    {
        "Key": "AddCommunication",
        "Value": "Add Communication"
    },
    {
        "Key": "AdvancedSettings",
        "Value": "Advanced Settings"
    }
]
}
Run Code Online (Sandbox Code Playgroud)

Ser*_*tov 7

你不能在运行时的strings.xml中写任何东西.相反,您可以写入共享首选项,数据库或内部/外部存储中的文件.所有这些方式都列在Android开发者网站上.