How do I add and remove views such as TextViews from Android app like on the original stock Android contacts screen where you press a small icon on the right side of a field and it adds or deletes a field which consists of a TextView and an editTextView (from what I can see).
Any examples on how to achieve this?
ViewParents in general can’t remove views, butViewGroups can. You need to cast your parent to aViewGroup(if it is aViewGroup) to accomplish what you want.For example:
Note that all
Layouts areViewGroups.