John John - 1 year ago 64
Android Question

I wanna build something as in Image but couldnot start

I am new to android. I wanna do something as in picture. I have a form where the user enters the data. The data entered should be placed in the A and B of 1. If they enter only data in only one form i want to display
only one layout indicated as '1'. When user enter data in 3 forms, i want to display 3 layout indicated as 1, 2 and 3. In the same way when they enter data in 100 forms, i want to display 100 such. How can i achieve this??? Since I am new please explain me full logical part.Here is my image

Answer Source

You can add views dynamically to your layout. LinearLayout is appropriate parent viewgroup for this type. Create a single layout containing single 'A' and 'B' views.

for(int i=0; i<100; i++) {
    View view = LayoutInflater.from(context).inflate(R.layout.yourSingleView, null);
    TextVeiw a = (TextView) view.findViewById(;
    TextView b = (TextView) view.findViewById(;

Other ways can be using a listview or recyclerview. Depends upon your need. BTW i don't see any reason to take 100 inputs from user like this.