2

I have designed and have it working

enter image description here

Here in the above diagram when ever + button is clicked new set of text view and edit text comes if n times its clicked n times text view and edit text comes .I need to add all the value say as in the above 16+81+....sqft and show it in overall sqft can anyone tell me on how can I solve this and provide me a sample code.

Thanks

Varun Kumar
  • 101
  • 4

1 Answers1

0

so what i did was like the code below:

LinearLayout nameWrapper = new LinearLayout();
EditText edtName = new EditText();
List<EditText> passengersNameList = new ArrayList<>();
nameWrapper.addView(edtName);
passengersNameList.add(edtName);
for (int i=0;i<passengersNameList.size();i++) {
   Person person = new Person();
   int id = i*2;
   EditText name = passengersNameList.get(i);
   name.getText().toString();
}

for explaining it I have to say, you should add your EditTexts to a list then get them all from that list when needed. in your case get all list and current number when sqft is ready and add them all and put it in your total number text field.

answer is inspired by this link

Pouya Danesh
  • 1,557
  • 2
  • 19
  • 36