Suppose I create an EditText using the following code and add it to a programmatically created LinearLayout, will it get assigned some ID or do I need to manually assign one using setId()?
I ask this question because there is no chance of Android assigning the same id to two different views whereas if we do it ourselves, something like that might happen.
LayoutParams fparams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 5.0f);
LayoutParams tvparams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
LayoutParams btparams = new LayoutParams(25, 25);
first.setLayoutParams(fparams);
first.setOrientation(LinearLayout.HORIZONTAL);
EditText tv = new EditText(this);
tvparams.weight = 4.97f;
tv.setLayoutParams(tvparams);
tv.setHint("Destination Address / Postcode");
Button bt = new Button(this);
bt.setBackground(getResources().getDrawable(R.drawable.minus));
bt.setTextColor(Color.parseColor("#ffffff"));
bt.setTextSize(12f);
btparams.weight = 0.03f;
bt.setLayoutParams(btparams);
first.addView(bt);
first.addView(tv);
main.addView(first);