Hello everybody I would like to insert multiple records to my sqlite table at once,
This is what I've tried:
DBHelper.class
public void insertToOUTTRANS(ArrayList<String> arrListDocumentNumber){
ContentValues cv = new ContentValues();
for(String text : arrListDocumentNumber){
cv.put(KEY_DOCUMENTNUMBER, text);
}
myDataBase.insert(TBL_OUTTRANS, cv, null);
}
But I'm getting error in this line:
myDataBase.insert(TBL_OUTTRANS, cv, null);
Error says:
The method insert(String, String, ContentValues) in the type SQLiteDatabase is not applicable for the arguments (String, ContentValues, null)
MainActivity.class:
for(int i = 0; i< arrDocumentNumber.length; i++) {
ArrayList<String> arrListDocumentNumber = new ArrayList<String>();
ArrayList<String> arrListUnitOfMeasure = new ArrayList<String>();
ArrayList<String> arrListLocationCode = new ArrayList<String>();
arrListDocumentNumber.put(tvItemCode.getText().toString());
arrListUnitOfMeasure.put(editText1.getText().toString));
arrListLocationCode.put(editText1.getText().toString));
}
But I'm kinda confused how to loop over the cursor to check for all items from the listview to save to my table. Any ideas? I would gladly appreciate your help. Thanks.