Consider You have arraylist of type String, that need to be dislayed on the Screen.
For the Layout XML file, define an ID, lets say ‘mainView’. Consider it to be Liner Layout and Oriented Vertically.
In Activity Class,
Here, the disadvantage of this method is Performance and Memory Constraints.
Suppose, instead of 10 items, suppose there are 1000 items defined in the ArrayList, above method creates 1000 Views.
Though, Mobile Display can show only few number of items at Once, and there is possibility that User will not scroll through all the items, creating all the Views before hand is Un-necessary, wastage of memory allocation and will also cause performace issues as you device has very limited memory, and you will find device being slow.
For Example, Contacts app, where the use sees only whats necessary from a pile of huge number of contacts.
To do it in an efficient way, check ListView With ArrayAdapters.
References: Udacity, Android Developer Document, Code Path, StackOverflow.