title: How to assign values from an array to textviews  in android
body: <p>I have 4 textview such as t11,t12,t13,t14 and I have also 4 value in array val[4].</p>
  
  <p>I want to store these values randomly in textviews. but I am getting little problem.</p>
  
  <p>I have done following code:</p>
  
  <pre><code>  TextView t11,t12,t13,t14;
    Random r = new Random();
  
    for (int i = 0; i &lt; val.length; i++) {
          int val[4]=r.nextInt(10);
          Log.d("horror", "Randm Array of VAL:" +val[i]);
    }
  </code></pre>
  
  <p>In the Log,there are 4 values displayed but how to display them in textviews.</p>
  
  <p>I have coded but it does not work properly.</p>
  
  <pre><code>  t1[i+1].setText("" +val[i]);
  </code></pre>
  
  <p>and 
        In this case,values are properly displayed, but i want to do code optimization.     </p>
  
  <pre><code>  t11.setText("" +val[0]); 
    t12.setText("" +val[1]); 
    t13.setText("" +val[2]);
    t14.setText("" +val[3]);
  </code></pre>
  
  <p>Thanks in advance.</p>