title: java.lang.IllegalArgumentException: Can't have a viewTypeCount < 1
body: <p>I'm getting this error:</p>
  
  <pre><code>java.lang.IllegalArgumentException: Can't have a viewTypeCount &lt; 1
  </code></pre>
  
  <p>I'm pretty sure I know exactly what's causing it, but I don't know how to fix it.</p>
  
  <p>My app loads a users friends from the database. When the user has at least 1 friend to put in the list view, it's fine. When the user is brand new and has no friends yet, the app crashes because the listview has a count of 0.</p>
  
  <p>Is this simply a case of error handling?</p>
  
  <p>If I don't post all the necessary relevant code please let me know!</p>
  
  <p>Here is my adapter:</p>
  
  <pre><code>public class MyAdapter extends ArrayAdapter&lt;HashMap&lt;String, String&gt;&gt; {
  
      Context context;
      int resourceId;
      LayoutInflater inflater;
      private Context mContext;
  
      @Override
  
      public int getViewTypeCount() {                 
  
          return getCount();
      }
  
      @Override
      public int getItemViewType(int position) {
  
          return position;
      }
  
  
      ArrayList&lt;HashMap&lt;String, String&gt;&gt;  items;
      public MyAdapter (Context context, int resourceId, ArrayList&lt;HashMap&lt;String, String&gt;&gt; items)
      {
          super(context, resourceId, items);
          mContext = context;
          this.items =items;
          inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent){
          final ViewHolder holder;
          if (convertView == null){
  
              convertView = inflater.inflate(R.layout.list_item, null);
  
              holder = new ViewHolder();
              holder.fbphoto = (ImageView)convertView.findViewById(R.id.fbphoto);
              holder.name = (TextView)convertView.findViewById(R.id.name);
  
     convertView.setTag(holder);
  
          } else {
  
              holder = (ViewHolder)convertView.getTag();
          }
  
  
  
          final HashMap&lt;String,String&gt; item = (HashMap&lt;String,String&gt; ) items.get(position);
          if (item != null)
          {
  
              String facebookProfilePicUrl = "https://graph.facebook.com/"+item.get(TAG_FACEBOOKID)+"/picture?width=150&amp;height=150";
  
              Picasso.with(mContext)
              .load(facebookProfilePicUrl)
              .placeholder(R.drawable.no_image)
              .into(holder.fbphoto);
  
  holder.name.setText(item.get(TAG_USERNAME));
  
   }
  
          return convertView;
      }
  
      public class ViewHolder
      {
          ImageView fbphoto;
          TextView    name;
  
      }
  }
  </code></pre>