首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >可以在sting.xml上存储大字符串吗

问可以在sting.xml上存储大字符串吗
EN

Stack Overflow用户
提问于 2017-07-14 02:34:33
回答 2查看 46关注 0票数 0

我正在创建一个赞美诗应用程序,这包含了500首赞美诗。那么,是否可以将这500首赞美诗歌词存储在string.xml中,或者我应该将其存储在数据库中,因为我不希望我的应用程序占用太多内存空间。谢谢

EN

回答 2

Stack Overflow用户

发布于 2017-07-14 03:30:33

我认为如果你把它们放在Json文件中,并在第一次安装时向用户显示一个带有加载动画的闪屏,在加载过程中,你可以解析json文件并将其保存在Json文件的realm数据库示例中:

代码语言:javascript
复制
    [
  {
    "Hymn1": {
      "title": "title 1",
      "singer": "singer1",
      "Lyrics": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum"
    }
  },
  {
    "Hymn2": {
      "title": "title 2",
      "singer": "singer2",
      "Lyrics": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum"
    }
  }
]

您可以查看realm的文档:https://realm.io/docs/java/latest/#json

票数 0
EN

Stack Overflow用户

发布于 2017-07-14 05:29:00

您可以将所有信息存储在一个.json文件中,并将该文件放入您的应用程序中。你会注意到这个文件不会很重。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45088554

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档