简体   繁体   English

如何在Android中更快地从本地sqlite数据库加载数据?

[英]How to load data from local sqlite db faster in Android?

I have about 300 records with multiple columns in sqlite db which I have to display in different textviews of a fragment. 我在sqlite db中有大约300条带有多列的记录,这些记录必须在片段的不同textview中显示。 So, while switching from one fragment to that very fragment then it loads slowly (it takes around 15 seconds or so to display those data). 因此,当从一个片段切换到那个片段时,它加载缓慢(显示这些数据大约需要15秒)。 What can be remedy to load the fragment faster? 有什么补救办法可以更快地加载片段?

Thank you in advance. 先感谢您。

You don't need to load all data at once, you need to look into "Lazy Loading" pattern, where you getting data on demand, when it really need to show up on the screen. 您不需要一次加载所有数据,您需要查看“延迟加载”模式,当真正需要在屏幕上显示数据时,您可以按需获取数据。

Here is one of many implementations - android-lazyloading-cursor 这是许多实现之一-android-lazyloading-cursor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从本地领域数据库加载数据? - How to load data from local realm db? 如何从sqlite db加载超过1 MB的数据到android游标? - how to load more than 1 MB data from sqlite db to android cursor? Android sqlite db将数据加载到服务器并截断 - Android sqlite db load data to server and truncate 自定义ArrayAdapter和来自SQLite本地数据库的数据 - Custom ArrayAdapter with data from SQLite local db Android:如何在sqlite中更快地插入数据 - Android: how to insert data faster in sqlite 如何从 Android 上的数据/数据文件夹复制 SQLite 数据库? - How to copy SQLite db from data/data folder on Android? 从云端硬盘中的sqlite数据库读取并将其写入本地数据库-Android - Read from sqlite db in Drive and write it to local db - Android 如何从本地资产加载特定的 js 文件,而不是从网站加载它,以便在 android WebView 中更快地加载? - How to load a specific js file from local assets instead loading it from website for faster loading in android WebView? 如何从本地sqlite糖数据库android检索数据 - How to retrieve data from local sqlite sugar database android SQLite-Android-显示现有数据库中的数据 - SQLite - android - display data from existing DB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM