Java – Add text boxes dynamically in android

Add text boxes dynamically in android… here is a solution to the problem.

Add text boxes dynamically in android

I’m working on an application that needs to add a text box to View when a button is selected. How do I do or add any object dynamically. What class do I use or what method do I need to call? Thank you.

Solution

You only need to call the addView method on the target View. This is a method inherited from ViewGroup, see [here][2].

[2]:http://developer.android.com/reference/android/view/ViewGroup.html#addView(android.view.View, android.view.ViewGroup.LayoutParams)

Related Problems and Solutions