I want to display 26 textviews. How to display an array of TextViews in android dynamically?
2 Answers
see the bellow code
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
LinearLayout ll=new LinearLayout(this);
for(int i=0;i<26;i++){
TextView tv=new TextView(this);
// or get your TextView from array
char c=(char)(65+i);
tv.setText(" "+c);
ll.addView(tv);
}
setContentView(ll);
}
but this type of design is not good,instead try to use ListView with CustomAdapters.