gpt4 book ai didi

java - 在Android中编写strings.xml

转载 作者:行者123 更新时间:2023-12-01 07:35:27 25 4
gpt4 key购买 nike

我正在开发一个 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"
}
]
}

最佳答案

运行时您无法在 strings.xml 中写入任何内容。相反,您可以写入共享首选项、数据库或内部/外部存储中的文件。所有这些方式都列在Android Developers site上.

关于java - 在Android中编写strings.xml,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12673029/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com