我是初學android的開發者。我需要你的幫助。我想將我的訂單插入到sqlite,tblorder和orderdtl的2個表中。從多個listview中插入的orderdtl。當我嘗試保存所有。只有最後一行已經插入到orderdtl中,其他表沒有問題。任何人都可以解決這個問題嗎?這是我的代碼只在listview中插入最新的行到sqlite中
btnsaveto.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
String orderid=orderid();
String orderdate=orderdate();
String notes = edtnotes.getText().toString();
long outletid = Globals.outletid;
order = dataSource.createorder(orderid, orderdate, notes, outletid);
for(int i=0; i< Globals.mylist.size() ;i++){
Globals.mylist.set(i, map1);
map1.get(Id);
map1.get(qty);
orderdtl = dataSource.createorderdtl(orderid, Id, qty);
Globals.mylist.remove(i);
Toast.makeText(EntryTO.this, "masuk Order \n" +
"ID :" + order.getorderid() +"\n" +
"DATE:" + order.getorderdate() +"\n" +
"NOTES :" + order.getnotes() +"\n" +
"OUTLET ID" + order.getoutletid() +"\n" +
"ID :" + orderdtl.getorderid() +"\n" +
"ID PRODUK :" + orderdtl.getId() +"\n" +
"QTY :" +orderdtl.getqty(),Toast.LENGTH_LONG).show();
}
//Intent i3 = new Intent(EntryTO.this, ViewOrder.class);
//startActivity(i3);
}
});