Here is my image
How can i add a new layout PROGRAMATICALLY(with a button and an EditText)on CLICK of a '+' button and set a unique id for each child(like in the pic).
private Button buttonItemArray[] = new Button[50];
private EditText edtValueArray[] = new EditText[50];
int itemId = itemCounter;
int valueId = valueCounter;
LinearLayout linearLayout = new LinearLayout(
getApplicationContext());
linearLayout.setOrientation(0);
buttonItemArray[j] = new Button(NewVendorDetailActivity.this);
buttonItemArray[j].setLayoutParams(edtName.getLayoutParams());
buttonItemArray[j].setId(itemId);
buttonItemArray[j].setText(name);
edtValueArray[j] = new EditText(NewVendorDetailActivity.this);
edtValueArray[j].setLayoutParams(edtName.getLayoutParams());
edtValueArray[j].setId(valueId);
edtValueArray[j].setBackgroundResource(android.R.drawable.editbox_background_normal);
edtValueArray[j].setSingleLine(true);
edtValueArray[j].setText(value);
linearLayout.addView(txtItemArray[j]);
linearLayout.addView(edtValueArray[j]);
layout.addView(linearLayout);
itemCounter++;
valueCounter++;
j++;
try this type add button custom ..........