简体   繁体   English

Android应用需要大量时间从sqlite加载数据

[英]Android app taking much time to load data from sqlite

I am making an android app which requires 1200 records to insert and then fetch. 我正在制作一个需要1200条记录才能插入然后获取的android应用。 I am using sqlite as back end. 我正在使用sqlite作为后端。 Everything is working fine but app takes lot of time to load the data at very first time for new installation. 一切工作正常,但应用程序在首次安装时需要花费大量时间来加载数据。 I am using SQLiteOpenHelper class to insert data. 我正在使用SQLiteOpenHelper类插入数据。 Please suggest ways to reduce the time to load the data at very first time. 请提出减少第一次加载数据时间的方法。

EDIT : I resolved my problem:) Here is how? 编辑:我解决了我的问题:)这是怎么回事? My app was taking much time because, I was inserting all the 1200 records at a time. 我的应用程序花费了很多时间,因为我一次插入了所有1200条记录。 Now i changed my code such that it should insert only required data one at a time so it saved my lot of time. 现在,我更改了代码,使其一次只能插入所需的数据,从而节省了很多时间。

Use transactions as explained in this answer and make sure that you are only creating one connection to the SQL database for the transaction(s) 按照此答案中的说明使用事务,并确保仅为事务创建一个到SQL数据库的连接

There should be a significant speed increase 速度应该大大提高

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

相关问题 布局花了太多时间来加载android - layout taking too much time to load android 安装后,Android App第一次加载时间太长,显示空白屏幕 - Android App is taking too much time to load for the first time after installation, showing blank screen 数据库插入花费太多时间-Android sqlite - Database insertion taking too much time- android sqlite Android:设备响应 SQLite 的时间过长 - Android :Device taking too much time to respond with SQLite 棉花糖与SQLite绑定数据花费太多时间 - Marshmallow with SQLite Binding data taking too much time 从Sqlite游标创建Pojo类花费了太多时间 - Pojo class creation from Sqlite cursor is taking too much time 为什么Android中的VideoView花费太多时间从http链接加载和播放视频? - Why VideoView in android is taking too much time to load and play the video from http link? Android虚拟设备花费太多时间来加载操作系统 - Android virtual device taking too much time to load OS Android Studio 2.1.1应用花费太多时间来启动应用 - Android studio 2.1.1 app taking too much time to launch app 谷歌应用引擎花了太多时间来提供端点android的响应 - google app engine taking too much time in giving response from endpoint android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM