title: No good position of Images in BaseAdapter
body: <p>I have a PullToRefresh ListView with 5 sections (each section is a item of the list), and each section has a number of photos. I have an BaseAdapter class which fills the 5 sections with the section photos. The problem is when the first time I load the listview, the photos don't appear correctly, but when I do scroll, then, the photos appear in the correct position. 
  I use the BitmapFun code for loading the photos. </p>
  
  <p>I have:</p>
  
  <pre><code>private ArrayList&lt;Pair&lt;Integer, ArrayList&lt;String&gt;&gt;&gt; section_photos_url;
  </code></pre>
  
  <p>The first value is the section, and the second is an array of photos of each section.</p>
  
  <p>The getView method :</p>
  
  <pre><code>public View getView(int position, View convertView, ViewGroup container) {
  
      if (position &lt; 5) {
  
          ItemViewHolder viewHolder;
  
          // Si la vista de dicha posicion ha sido inflada
          if (view_array[position] == null) { 
  
              // Inflate the view
              LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
              switch (section_photos_url.get(position).first) {
              case ConstantsTypeSection.SECTION1:
                  view_array[position] = li.inflate(R.layout.timeline_section_today_trending, container, false);
                  break;
              case ConstantsTypeSection.SECTION2:
                  view_array[position] = li.inflate(R.layout.timeline_section_trendy_smiler, container, false);
                  break;
              case ConstantsTypeSection.SECTION3:
                  view_array[position] = li.inflate(R.layout.timeline_section_around_me, container, false);
                  break;
              case ConstantsTypeSection.SECTION4:
                  view_array[position] = li.inflate(R.layout.timeline_section_trending_hashtag, container, false);
                  break;
              case ConstantsTypeSection.SECTION5:
                  view_array[position] = li.inflate(R.layout.timeline_section_last_content, container, false);
                  break;
              }
  
              viewHolder = new ItemViewHolder();
  
              viewHolder.sectionName = (TextView) view_array[position].findViewById(R.id.section_name);
              viewHolder.userName = (TextView) view_array[position].findViewById(R.id.user_name);
              viewHolder.hashTag = (TextView) view_array[position].findViewById(R.id.hash_tag_name);
  
              viewHolder.userImage = (ImageView) view_array[position].findViewById(R.id.user_photo);
  
              viewHolder.item1 = (RecyclingImageView) view_array[position].findViewById(R.id.item_1);
              viewHolder.item2 = (RecyclingImageView) view_array[position].findViewById(R.id.item_2);
              viewHolder.item3 = (RecyclingImageView) view_array[position].findViewById(R.id.item_3);
              viewHolder.item4 = (RecyclingImageView) view_array[position].findViewById(R.id.item_4);
              viewHolder.item5 = (RecyclingImageView) view_array[position].findViewById(R.id.item_5);
              viewHolder.item6 = (RecyclingImageView) view_array[position].findViewById(R.id.item_6);
              viewHolder.item7 = (RecyclingImageView) view_array[position].findViewById(R.id.item_7);
              viewHolder.photos_layout = (LinearLayout) view_array[position].findViewById(R.id.photo_section);
  
              view_array[position].setTag(viewHolder);
          } else {
              viewHolder =  (ItemViewHolder) view_array[position].getTag();
          }
  
          switch (section_photos_url.get(position).first) {
          case ConstantsTypeSection.SECTION1:
                   viewHolder.sectionName.setText(context.getResources().getString(R.string.today_trending_section));
  
            LinearLayout.LayoutParams lp = new  LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,    LinearLayout.LayoutParams.WRAP_CONTENT);
          viewHolder.photos_layout.addView(getPhotoView(section_photos_url.get(0).second), lp);
  
              break;
          case ConstantsTypeSection.SECTION2:
              viewHolder.sectionName.setText(context.getResources().getString(R.string.trendy_smiler_section));
  
                            LinearLayout.LayoutParams lp = new  LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,    LinearLayout.LayoutParams.WRAP_CONTENT);
          viewHolder.photos_layout.addView(getPhotoView(section_photos_url.get(1).second), lp);
  
              break;
          case ConstantsTypeSection.SECTION3:
              viewHolder.sectionName.setText(context.getResources().getString(R.string.around_me_section));
  
                            LinearLayout.LayoutParams lp = new  LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,    LinearLayout.LayoutParams.WRAP_CONTENT);
          viewHolder.photos_layout.addView(getPhotoView(section_photos_url.get(2).second), lp);
              break;
          case ConstantsTypeSection.SECTION4:
              viewHolder.sectionName.setText(context.getResources().getString(R.string.trending_hashtag_section));
  
                            LinearLayout.LayoutParams lp = new  LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,    LinearLayout.LayoutParams.WRAP_CONTENT);
          viewHolder.photos_layout.addView(getPhotoView(section_photos_url.get(3).second), lp);
              break;
          case ConstantsTypeSection.SECTION5:
              viewHolder.sectionName.setText(context.getResources().getString(R.string.last_content_section));
  
  
                            LinearLayout.LayoutParams lp = new  LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,    LinearLayout.LayoutParams.WRAP_CONTENT);
          viewHolder.photos_layout.addView(getPhotoView(section_photos_url.get(0).second), lp);
              break;
          }
  
          return view_array[position];
  
      } else {
          return null;
      }
  }
  
  private class ItemViewHolder {
      TextView sectionName;
      TextView userName;
      TextView hashTag;
      ImageView userImage;
  
      RecyclingImageView item1;
      RecyclingImageView item2;
      RecyclingImageView item3;
      RecyclingImageView item4;
      RecyclingImageView item5;
      RecyclingImageView item6;
      RecyclingImageView item7;
  
      LinearLayout photos_layout;
  
  }
  
  
    private View getPhotoView(ArrayList&lt;String&gt; photos) {
  
      View view = null;
  
      LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      switch (photos.size()) {
      case 1:
          break;
      case 3:
          view = li.inflate(R.layout.timeline_item_three, null, false);
          break;
      case 5:
          if (Math.random() * 2 &lt; 1) {
              view = li.inflate(R.layout.timeline_item_three_two, null, false);
          } else {
              view = li.inflate(R.layout.timeline_item_two_three, null, false);
          }
          break;
      case 7:
      default:
          view = li.inflate(R.layout.timeline_item_seven, null, false);
          break;
      }
  
      RecyclingImageView image = null;
      for (int i = 0; i &lt; photos.size(); i++) {
          switch (i) {
          case 0:
                image =  (RecyclingImageView) view.findViewById(R.id.item_1);
              break;
          case 1:
              image =  (RecyclingImageView) view.findViewById(R.id.item_2);
              break;
          case 2:
              image =  (RecyclingImageView) view.findViewById(R.id.item_3);
              break;
          case 3:
              image =  (RecyclingImageView) view.findViewById(R.id.item_4);
              break;
          case 4:
              image =  (RecyclingImageView) view.findViewById(R.id.item_5);
              break;
          case 5:
              image =  (RecyclingImageView) view.findViewById(R.id.item_6);
              break;
          case 6:
              image =  (RecyclingImageView) view.findViewById(R.id.item_7);
              break;
          }
  
          CacheLoaderImagesSingleton.getInstance().getImageFetcher().loadImage(photos.get(i), image);
      }
  
      return view;
  }
  </code></pre>
  
  <p>Any suggestions to show the images correctly? Those are the images. First one is the wrong images because all photos have to be purple flower photos, and don't yellow. Second one is the correct. The images are part of a section</p>
  
  <p><img src="https://i.stack.imgur.com/Fv1uR.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/gXAoX.png" alt="enter image description here"></p>