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, TextView, CheckBox, ImageView, WebView, 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!
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