`public void refereshBill(boolean all) { int rowTemp = 0 ;
if (all == false )
rowTemp = rowIndex ;
for (int row = rowTemp ; row <= rowIndex ; row++)
{
for (int i = 0; i < MAX; i++)
{
TextView editText = new TextView(this);
GridLayout.LayoutParams param = new GridLayout.LayoutParams();
param.height = GridLayout.LayoutParams.WRAP_CONTENT;//ViewGroup.LayoutParams.WRAP_CONTENT;
// String id_text = String.valueOf(rowIndex) + String.valueOf(i) ;
// int id_int = Integer.valueOf(id_text);
// editText.set
if (i == 2)
param.width = 70; // Qualnity GridLayout.LayoutParams.MATCH_PARENT;
else if (i == 3)
param.width = 100; //Rate//-25
else if (i == 4)
param.width = 80; //Discount-20
else if (i == 5)
param.width = 140; // Amount-20
else if (i == 6)
param.width = 40; // %
else if (i == 7)
param.width = 75; // cTax
else if (i == 8)
param.width = 75; // sTax
else if (i == 9)
param.width = 180; // Ttoal amount
else
param.width = 45 + (i * 250);
param.rowSpec = GridLayout.spec(1 + row);
param.columnSpec = GridLayout.spec(i);
param.setMargins((5), 5, 0, 0);
///////editText.setTextColor(R.color.colorPrimaryDark);
editText.setTextSize(12);
editText.setTextColor(Color.BLACK);
editText.setBackgroundColor(0xFFFFFFFF);
editText.setLayoutParams(param);
/////// editText.setId(Integer.parseInt("i"));
editText.setText(BillArray[row][i]);
Glyout.addView(editText);
}
}
showBillTotal();
}`
I have program creates a bunch of rows of textviews with different columns. as and when the user add an item for the bill .So if the user wants to change the quantiy at any point of time and clicks on item name .Can i get a reference view .so that i can process further.How can it be done for addition or deletion of a row , or update its values. Each row is billed item details, like item name ,rate ,etc enter image description hereImage shows different rows of items added into the bill as and when Clerck adds new item number ,it gets added to the list . Thanks naveen
I think for a task like this just use ListView instead of TextView
User contributions licensed under CC BY-SA 3.0