As Android developer you will surely need someday to add views dynamically, instead of creating a ListView. This example demonstrates a way to add or remove views to a LinearLayout dynamically.
1. Here we are encapsulating out component in a LinearLayout. RelativLayout defines views at the top that have an EditText which takes in the content to be added and a Button that actually adds the view with the content and inflates it as a child to LinearLayout '@+id/container'.
2 Set onClick listeners for add button in our layout using setOnClickListener and embed one for delete button within it.
And there you go!