title: ArrayIndexOutOfBoundsException: length=20; index=20?
body: <p>it shows me this error when I enter in my listview over 20 "pieces", how can I do to avoid this?</p>
  
  <pre><code>&gt; java.lang.ArrayIndexOutOfBoundsException: length=20; index=20
  &gt;  at com.Amarildo.asd.List_View_Esercizi.getView(List_View_Esercizi.java:33)
  </code></pre>
  
  <p>the error is at this line </p>
  
  <pre><code>img.setImageResource(imageId[position]);
  </code></pre>
  
  <p>appears only if I post in the listview more than 20 components</p>
  
  <p>This is my adapter</p>
  
  <pre><code>public class List_View_Esercizi extends ArrayAdapter&lt;String&gt; {
  
  private Activity context;
  private String[] nome;
  private Integer[] imageId;
  
  public List_View_Esercizi(Activity context, String[] nome, Integer[] imageId) {
      super(context, R.layout.list_view_esercizi, nome);
      this.context = context;
      this.nome = nome;
      this.imageId = imageId;
  }
  
  public View getView(int position, View view, ViewGroup parent){
      LayoutInflater inflater = context.getLayoutInflater();
      View rowView = inflater.inflate(R.layout.list_view_esercizi, null, true);
      TextView txt = (TextView) rowView.findViewById(R.id.textView);
      ImageView img = (ImageView) rowView.findViewById(R.id.imageView2);
      txt.setText(nome[position]);
      img.setImageResource(imageId[position]);
      return rowView;
  }
  </code></pre>