title: How can I reuse images in Listview?
body: <p>For example:</p>
  
  <p>I have 200 items but just 3 images. I want:</p>
  
  <p>item at position 0 - show image 1</p>
  
  <p>item at position 1 - show image 2</p>
  
  <p>item at position 2 - show image 3</p>
  
  <p>item at position 4 - show image 1....</p>
  
  <p>But when I scroll, the items doesnt show image in correct order. Here is my adapter:</p>
  
  <pre><code>public class MyAdapter extends BaseAdapter {
  
      private Context mContext;
      private int[] mResourceId;
      private ImageLoader mImageLoader;
      private int dummycount1 = 0;
      private int dummycount2 = 1;
      private int dummycount3 = 2;
      private int dummycount4 = 3;
      private ViewHolder viewHolder;
  
      public MyAdapter(Context context, int[] resourceId) {
          // TODO Auto-generated constructor stub
          mContext = context;
          mResourceId = resourceId;
          mImageLoader = new ImageLoader(mContext);
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return 200;
      }
  
      @Override
      public Object getItem(int position) {
          // TODO Auto-generated method stub
          return null;
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return 0;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
  
          if (convertView == null) {
              LayoutInflater layoutInflater = LayoutInflater.from(mContext);
              convertView = layoutInflater.inflate(R.layout.item_listview, parent, false);
              viewHolder = new ViewHolder();
              viewHolder.img1 = (ImageView) convertView.findViewById(R.id.imageView1);
              viewHolder.img2 = (ImageView) convertView.findViewById(R.id.imageView2);
              viewHolder.img3 = (ImageView) convertView.findViewById(R.id.imageView3);
              viewHolder.pb1 = (ProgressBar) convertView.findViewById(R.id.progressBar1);
              viewHolder.pb2 = (ProgressBar) convertView.findViewById(R.id.progressBar2);
              viewHolder.pb3 = (ProgressBar) convertView.findViewById(R.id.progressBar3);
              convertView.setTag(viewHolder);
          } else {
              viewHolder = (ViewHolder) convertView.getTag();
          }
          Log.e("POSITION", "" + position);
          if (position == 0 || position == dummycount1 + 4) {
              myFunction(0);
              dummycount1 += 4;
          }
          else if (position == 1 || position == dummycount2 + 4) {
              myFunction(3);
              dummycount2 += 4;
          }
          else if (position == 2 || position == dummycount3 + 4) {
              myFunction(6);
              dummycount3 += 4;
          }
          else if (position == 3 || position == dummycount4 + 4) {
              myFunction(9);
              dummycount4 += 4;
          }
          return convertView;
      }
  </code></pre>