how to bulk insert in sqlite in android

前端 未结 5 1086
野趣味
野趣味 2020-12-03 10:09

I am using SQLiteOpenHelper for data insertion. I need to insert 2500 id and 2500 names, So it takes too much time. Please any one help me how to reduce the insertion tim

5条回答
  •  时光取名叫无心
    2020-12-03 10:45

    Put your queries in string array in string.xml, open them in code with resource handler and perform them in cycle. Before cycle use beginTransaction() and entTransaction() methods to rollback changes in case failure.

提交回复
热议问题