You can improve speed for Multiple/Batch Database Inserting or Replacing operation using concept of transaction and compileStatement so your query will be compiled only once.
For Example:
db.beginTransaction();
try {
String sql = "Insert or Replace into Items (itemNumber, description,unitOfMeasure, weight) values(?,?,?,?)";
ArrayList<ItemMaster> itemsList = // Retrieve your items list here
for(int i=0;i<itemsList.size();i++)
{
SQLiteStatement insert = db.compileStatement(sql);
insert.bindString(1, item.getItemNumber());
insert.bindString(2, item.getItemDescription1());
insert.bindString(3, item.getSellingUOM());
insert.bindDouble(4, item.getWeight());
insert.execute();
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
2
solved Multiple Insert or Replace Query in Android SQLite