I\'m developing Contact Application, which adds Email address, phone number. I have to create edit text dynamically in code itself. I don\'t know how and where to implement
EditText within the LinearLayout.
Try this.
LinearLayout linearLayout = new LinearLayout(getContext());
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
linearLayout.setOrientation(LinearLayout.VERTICAL);
layoutParams.setMargins(2, 1, 2, 1);
linearLayout.setLayoutParams(layoutParams);
EditText editText = new EditText (getContext());
editText .setTextSize(15);
editText .setLayoutParams(layoutParams);
linearLayout.setGravity(Gravity.CENTER);
editText .setText(Html.fromHtml(directiveMessage));
linearLayout.addView(editText );