Android app, using a loop value to set visibilty and add data to textview?

I am creating an app that allows user to enter values and depending on the value a number of textviews are changed programmatically from gone to visible.
In the xml file there is TV!,TV2 and TV3, The user enters a couple of numbers from previous activity and these are used to set the visibility of the TV1,TV2 and TV3 textviews

Example:
            User enters 2.
Using a for loop 
        for (int i = 0; i<= userinput; i++){
          showTV = "TV"+(i);
          showTV.setVisibility(View.VISIBLE);
          showTV.setText(String.valueOf(list1.get(1)));

But I can not get the textview’s Id to be recognized using the i value

Can it be done this way or is this the wrong direction.

1 Like