i have a TableLayout... im try to get the values of each row from the TableLayout to query an insert statement to table. i have tried something, but it doesnt work out
Table Rows
for (int i = 0; i < list.size(); i++)
{
tr = new TableRow(this);
tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
codeTV = new TextView(this);
codeTV.setText(code.get(i));
codeTV.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
tr.addView(codeTV);
companyTV = new TextView(this);
companyTV.setText(list.get(i));
companyTV.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
tr.addView(companyTV);
tl.addView(tr, new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
}
getting the values of each row
Button btnComplete = (Button) findViewById(R.id.posbtnsave);
btnComplete.setOnClickListener(new OnClickListener(){
public void onClick(View view){
TableRow t = (TableRow) view;
final TextView i_code = (TextView) t.getChildAt(0);
final TextView i_comp = (TextView) t.getChildAt(1);
String cc= i_code.getText().toString();
String ccm= i_comp.getText().toString();
}
});
This is what i tried.... is there any other ways where i could get the values row by row to query insert statement
Aucun commentaire:
Enregistrer un commentaire