You create a text view and set its value, but do not specify where and how it should be displayed. Your myText object must have a container that makes it visible.
What you are trying to do is dynamically expand the view. See here for a good article for beginners . From the article:
// This is where and how the view is used TextView tv = new TextView(this); tv.setText("Dynamic layouts ftw!"); ll.addView(tv); // this part is where the containers get "wired" together ScrollView sv = new ScrollView(this); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); sv.addView(ll);
source share