Android: Handling very large data sets in ContentProvider to avoid memory limits

ぐ巨炮叔叔 提交于 2019-11-30 16:23:43
CL.

Mobile devices are not designed to handle these amounts of data.

However, if you really want to inflict such a large scrolling list on your poor users, you can design it as a virtual list where entries are loaded only on demand; see Android Endless List.

Note: Using the OFFSET clause is inefficient; see Scrolling Cursor for details.

I agree with CL that you shouldn't do this. This isn't a good idea on mobile and neither is it on desktops. Who wants to scroll 30000 elements? What for? Most probably the user is looking for one result only, isn't she? So provide an easy way to filter the result set.

Until the result set is small enough to be actually usable (this is not the same as the list scrolling fine - it's probably a much smaller number of results) you simply should display the total number of hits for the current query and maybe some elements as a sample to the user. The user must filter the list to get to actually usable sizes.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!