How to Add a Child View, with LayoutParams, to a LinearLayout, in Java

public void addView (View child) was added in API level 1
Adds a child view. If no layout parameters are already set on the child, the default parameters for this ViewGroup are set on the child.
Parameters: child - the child view to add

1. Instantiate a new LinearLayout object, in Java named myLinearLayout.

2. Instantiate a widget to add to the myLinearLayout such as an EditTextTextViewCheckBoxImageViewWebView, etc. I use a TextView example named myTextView.

3. Add Width and Height to LayoutParams to the widget you instantiated. I will create a LayoutParams named myTextViewLP for my TextView, with the settings of MATCH_PARENT  for width, and WRAP_CONTENT for height for the myTextView.

4.Add the below line after your instantiated widget. For example, this line below will add a TextVew named myTextView to the LinearLayout named myLinearLayout.

myLinearLayout.addView(myTextView, myTextViewLP);

5. Compile and run!

Resources: http://developer.android.com/reference/android/view/ViewGroup.html#addView(android.view.View)
http://stackoverflow.com/questions/17841003/alertdialog-with-2-textbox-doesnt-work-correctly