How to Add a Child View 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 EditText, TextViewCheckBox, ImageView, WebView, etc. 

3.Add the below line after your instantiated widget. For example, this line below will add a CheckBox named myCkeckBox to the LinearLayout named myLinearLayout.

myLinearLayout.addView(myCheckBox);

4. 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