大量数据......如此混乱。我不想减慢系统速度
我的应用程序从网络下载信息(顺便说一句,根据网站规则,这是合法的), 然后在解析完每个页面(64页)后将它们存储到一个数组中。 这些字符串数组被转换为相对布局数组,以使数据加载到滚动视图上的速度更快(这样,如果再次出现相同的页面,则不必再次格式化所有数据)。
我有大约 64 个字符串数组和类似的 64 个相对布局数组。我需要如此多的数组,因为每个数组都包含特定类型的数据,这些数据必须以不同的格式放入相对布局中。
数据由统计数据和链接组成。
如何管理如此大量的数据?
我已经想出了如何管理它......但它需要大量的 switch case 和 if/else 语句。
还有其他想法吗?
My app downloads info from the web (which is btw legal according to the sites rules),
and then stores them into an array after parsing through each page (64 pages).
Those arrays of strings are converted into arrays of relative layouts to make the loading of data onto scrollview much faster (so that if the same page comes again it doesnt have to format all the data again).
I have about 64 arrays of strings and similarly 64 arrays of relative layouts. I need so many arrays because each contain a specific type of data which have to put into the relative layouts in a different formats.
The data consists of statistics and links.
How can I manage such a large amount of data with?
I have come up with how to manage it...but it requires a lot of switch cases and if/else statements.
Any other ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
优化代码以确保最短的时间对于正在处理的信息来说是非常具体的,因此我很难优化我没有见过的过程。
但是,我会说这是一个很长的任务,应该放在异步任务中。您还可以在处理数据时更新视图,以便在处理数据后立即可用。这将通过
onProgressUpdate()
来完成。有关 asynctasks 的信息:
Optimizing your code to ensure that the least amount of time is necessarily is very specific to the information being processed so it is difficult for me to optimize a process I have not seen.
However, I will say that this is a long task and should be in an Asynctask. You can also update the views as the data is being processed so that it is available the moment you have processed it. This would be done as a
onProgressUpdate()
.Information about asynctasks: