Efficient batch SQL query execution on Android, for upgrade database

邮差的信 提交于 2019-11-30 07:30:05

How do I insert these efficiently?

Use transaction:

    db.beginTransaction();
    try {
        for(;;) {
            db.execSQL(...);
            }
        db.setTransactionSuccessful();
    } finally {
        db.endTransaction();
    }

I think what you have is the only way to load those 1000 records, now, as far as deploying that DB with your apk file, check out this post:

http://www.helloandroid.com/tutorials/how-have-default-database

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