title: Items repeating when scrolling in ListView
body: <p>I am using a custom adapter in my listview. When I print out my data in my arraylist, it is stored correctly, though when I scroll items repeat. I know my getView method is kind of jumbled and confusing, though why is it not representing my arraylist data, "oslist," correctly?</p>
  
  <p>Here is my adapter code:</p>
  
  <pre><code>public class WXYCAdapter extends BaseAdapter {
  
  private FragmentActivity context;
  private ArrayList&lt;HashMap&lt;String, String&gt;&gt; oslist;
  private ArrayList&lt;HashMap&lt;String, String&gt;&gt; heartList;
  
  private LayoutInflater mInflater;
  
  private final static int STREAM_LAYOUT = 0;
  private final static int TALKSET_LAYOUT = 1;
  private final static int BREAKPOINT_LAYOUT = 2;
  private final static int PLAYCUT_LAYOUT = 3;
  private final static int NULL_LAYOUT = 4;
  
  String URL;
  ViewHolder holder;
  
  public WXYCAdapter(FragmentActivity context, ArrayList&lt;HashMap&lt;String, String&gt;&gt; oslist) {
      this.context = context;
      this.oslist = oslist;
      this.mInflater = (LayoutInflater) context
              .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  
  }
  
  
  @Override
  public int getCount() {
      return this.oslist.size();
  }
  
  @Override
  public Object getItem(int position) {
      return null;
  }
  
  @Override
  public long getItemId(int position) {
      return position;
  }
  
  @Override
  public int getItemViewType(int position) {
  
      int RETURN_LAYOUT = NULL_LAYOUT;
  
      switch (oslist.get(position).get("layoutType")) {
          case "LiveStream":
              RETURN_LAYOUT = STREAM_LAYOUT;
              break;
  
          case "Playcut":
              RETURN_LAYOUT = PLAYCUT_LAYOUT;
              break;
  
          case "Talkset":
              RETURN_LAYOUT = TALKSET_LAYOUT;
              break;
  
          case "Breakpoint":
              RETURN_LAYOUT = BREAKPOINT_LAYOUT;
              break;
      }
  
      return RETURN_LAYOUT;
  
  }
  
  @Override
  public int getViewTypeCount() {
      return 4;
  }
  
  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
  
      holder = null;
      int type = getItemViewType(position);
  
      if (convertView == null) {
          holder = new ViewHolder();
          switch (type) {
              case STREAM_LAYOUT:
                  convertView = mInflater.inflate(R.layout.listview_cell, null);
  
                  holder.cell_image = (ImageView) convertView.findViewById(R.id.cell_image);
                  holder.cell_image.setImageResource(R.drawable.boombox);
  
                  holder.song = (TextView) convertView.findViewById(R.id.song);
                  holder.artist = (TextView) convertView.findViewById(R.id.artist);
  
                  holder.song.setEnabled(false);
                  holder.song.setMaxHeight(0);
  
                  holder.artist.setEnabled(false);
                  holder.artist.setMaxHeight(0);
  
                  convertView.setTag(holder);
                  break;
  
              case TALKSET_LAYOUT:
                  convertView = mInflater.inflate(R.layout.listview_cell, null);
  
                  holder.cell_image = (ImageView) convertView.findViewById(R.id.cell_image);
                  holder.cell_image.setImageBitmap(null);
                  holder.cell_image.setEnabled(false);
                  holder.cell_image.setMaxHeight(0);
                  holder.cell_image.setMaxWidth(0);
  
                  holder.song = (TextView) convertView.findViewById(R.id.song);
                  holder.artist = (TextView) convertView.findViewById(R.id.artist);
                  holder.song.setText("Talkset");
                  holder.artist.setText(null);
  
                  holder.artist.setEnabled(false);
                  holder.artist.setMaxHeight(0);
  
                  convertView.setTag(holder);
                  break;
  
              case BREAKPOINT_LAYOUT:
                  convertView = mInflater.inflate(R.layout.listview_cell, null);
  
                  holder.cell_image = (ImageView) convertView.findViewById(R.id.cell_image);
                  holder.cell_image.setImageBitmap(null);
                  holder.cell_image.setEnabled(false);
                  holder.cell_image.setMaxHeight(0);
                  holder.cell_image.setMaxWidth(0);
  
                  holder.song = (TextView) convertView.findViewById(R.id.song);
  
                  //holder.song.setTypeface(Typeface.createFromAsset(context.getAssets(), "default.ttf"));
  
                  holder.artist = (TextView) convertView.findViewById(R.id.artist);
                  holder.song.setText("Breakpoint");
                  holder.artist.setText(null);
                  holder.artist.setEnabled(false);
                  holder.artist.setMaxHeight(0);
  
  
                  long l = Long.parseLong(oslist.get(position).get("hour"));
  
                  Calendar calendar = Calendar.getInstance();
                  calendar.setTimeInMillis(l);
                  calendar.setTimeInMillis(l * 1000);
  
                  int hour = calendar.get(Calendar.HOUR);
  
                  convertView.setTag(holder);
                  break;
  
              case PLAYCUT_LAYOUT: //Playcut
  
  
                  convertView = mInflater.inflate(R.layout.listview_cell, null);
  
  
                  //holder.cell_image = (ImageView) convertView.findViewById(R.id.cell_image);
  
                  //holder.cell_image.setImageResource(R.drawable.no_album_art);
  
                  holder.song = (TextView) convertView.findViewById(R.id.song);
                  holder.artist = (TextView) convertView.findViewById(R.id.artist);
  
                  holder.song.setText(oslist.get(position).get("songTitle"));
                  holder.artist.setText(oslist.get(position).get("artistName"));
  
                  convertView.setTag(holder);
                  break;
              case NULL_LAYOUT:
                  convertView.setTag(holder);
                  break;
  
          }
  
  
      } else {
          holder = (ViewHolder) convertView.getTag();
      }
  
      return convertView;
  
  }
  
  @Override
  public boolean hasStableIds(){
      return true;
  }
  
  
  
  public static class ViewHolder {
      public TextView textView, song, artist;
  
  
      public ImageView cell_image;
      public Button playButton;
  }
  </code></pre>
  
  <p>}</p>