title: Second type item appears when scrolling in android, different items listview example
body: <p>I want to add new <code>imageview</code> item for <code>7th, 14th, 21th</code> positions. </p>
  
  <p>When I add new item and create new layout type for it , it didn't work well.</p>
  
  <p>When scrolling lots of <code>imageview</code> (type2) items appear in different positions. </p>
  
  <p><strong>How can i solve this and whree is my mistake?</strong> </p>
  
  <p>(I tried only for seventh position in this codes to solve scrolling problem. )</p>
  
  <pre><code>    public class MyAdapter extends BaseAdapter{
  
      MyFragmentManager mFragmentManager;
      List&lt;Tier3Category&gt;list;   
      Context context;    
      ListView myList;
      OneriDetail myObj;
      Tier3Category obj;
  
  
      public MyAdapter(Context context, List&lt;Tier3Category&gt; list, MyFragmentManager mFragmentManager,
               ListView myList, int type) {
          super();
          this.mFragmentManager = mFragmentManager;
          this.list = list;
      if(list.size()&gt;1)
          list.add(7,new Tier3Category("", "", "", "", "", "", "", "", "", "", "", "", "", false, false, false, "", "", "", ""));
          Log.w("", list.size()+"asd");
          this.context = context;
          this.myList = myList;
      }
  
      @Override
      public int getCount() {
          // TODO Auto-generated method stub
          return list.size();
      }
  
      @Override
      public Tier3Category getItem(int position) {
          if (getCount()&gt;0){
              return list.get(position);
          }
          else{
              return null;
          }   
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
  
      @Override
      public View getView(final int position, View convertView, ViewGroup parent) {
          // TODO Auto-generated method stub
           final ViewHolder1 vh ;
           final ViewHolder2 vh2;   
  
  
           if(position!=7){           
           try {
              if (convertView==null){          
                   vh = new ViewHolder1();
  
                      convertView = LayoutInflater.from(context).inflate(
                              R.layout.adapter_oneri_list, parent, false);
                      vh.title = (TextView) convertView.findViewById(R.id.list_title);            
                      convertView.setTag(vh);
               }                                      
              else{
                  vh = (ViewHolder1)convertView.getTag();
                  }   
               convertView.setTag(vh);
          } catch (Exception e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
              }        
           }
  
           else {
               try {
                  if (convertView==null){     
                   vh2 = new ViewHolder2();
                      convertView = LayoutInflater.from(context).inflate(R.layout.adapter_adv_item, parent,false);
                      vh2.adv_photo = (ImageView) convertView.findViewById(R.id.adv_image);
                      convertView.setTag(vh2);    
  
                   }                                      
                      else{
                          vh2 = (ViewHolder2)convertView.getTag();
                          }
              } catch (Exception e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }               
           }
  
           return convertView;
      }
      public  class ViewHolder1{
          TextView comment_count , like_count , follow_count , username , time , title , content, location , categoryname;
          RoundedImageView sugg_photo;
          RoundedImageView user_photo;
          RelativeLayout threedot;
          ImageView likeIcon , commentIcon , followIcon;
      }
  
      public class ViewHolder2{
          ImageView adv_photo;        
      }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/zzkJD.png" alt="enter image description here">
  <img src="https://i.stack.imgur.com/xjufV.png" alt="enter image description here"></p>