Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TextView tv[] = new TextView()...
- for(...){
- tv[i]...
- }
- final int N = 10; // total number of textviews to add
- final TextView[] myTextViews = new TextView[N]; // create an empty array;
- for (int i = 0; i < N; i++) {
- // create a new textview
- final TextView rowTextView = new TextView(this);
- // set some properties of rowTextView or something
- rowTextView.setText("This is row #" + i);
- // add the textview to the linearlayout
- myLinearLayout.addView(rowTextView);
- // save a reference to the textview for later
- myTextViews[i] = rowTextView;
- }
Add Comment
Please, Sign In to add comment