Creating android app Database with big amount of data

后端 未结 4 445
轮回少年
轮回少年 2020-12-17 01:16

The database of my application need to be filled with a lot of data, so during onCreate(), it\'s not only some create table sql instructions, there is a lot of

4条回答
  •  悲哀的现实
    2020-12-17 02:06

    I am using a different approach: Instead of executing loads of sql statements (which will take long time to complete), I build my sqlite database on the desktop, put it in the assets folder, create an empty sqlite db in android and copy the db from the assets folder into the database folder. This is a huge increase in speed. Note, you need to create an empty database first in android, and then you can copy and overwrite it. Otherwise, Android will not allow you to write a db into the datbase folder. There are several examples on the internet. BTW, seems this approach works best, if the db has no file extension.

提交回复
热议问题