我正在创建一个赞美诗应用程序,这包含了500首赞美诗。那么,是否可以将这500首赞美诗歌词存储在string.xml中,或者我应该将其存储在数据库中,因为我不希望我的应用程序占用太多内存空间。谢谢
发布于 2017-07-14 03:30:33
我认为如果你把它们放在Json文件中,并在第一次安装时向用户显示一个带有加载动画的闪屏,在加载过程中,你可以解析json文件并将其保存在Json文件的realm数据库示例中:
[
{
"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
发布于 2017-07-14 05:29:00
您可以将所有信息存储在一个.json文件中,并将该文件放入您的应用程序中。你会注意到这个文件不会很重。
https://stackoverflow.com/questions/45088554
复制相似问题