Android大的String数组替代 [英] Android large String array alternatives

查看:113
本文介绍了Android大的String数组替代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对自己的活动有一个列表视图,我想为该列表视图实现输入搜索功能并可以访问过滤器。但是,数组中有很多字符串,以至于该活动需要一段时间才能加载或崩溃。

I have a list view on my activity that I want to implement a input search feature for the list view and have access to the filters. However, there are a lot of Strings in the array to the point that the activity takes a while to load or crashes.

当前我只能存储四分之一崩溃前的String数组中的String数量。我尝试按照Android文档中的说明以编程方式以及通过XML添加字符串。

Currently I am only able to store in a quarter of the Strings in the String array before it crashes. I've tried adding the Strings programmatically and also through XML as described in the android document.

什么是存储信息而不是将信息保存在字符串数组中的最佳选择?

What would be the best alternatives to store the information rather than keeping them in a String array?

谢谢

推荐答案


  1. 部分加载项目,例如前30个,如果用户想要更多,他会点击查看更多按钮。 (良好做法)

  2. 尝试将您的字符串写入文件,然后在需要时读取它们。

  1. Load items partially, for example first 30, if user wants more he will click view more button. (Good practice)
  2. Try to write your Strings to file, and then read them when needed.

这篇关于Android大的String数组替代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆