title: getView cannot display all items of list - android
body: <p>I've override a ArrayAdapter to display books info stored in the database. and following is the ViewHolderAdapter:</p>
  <pre><code>public class ViewHolderAdapter extends ArrayAdapter&lt;Book&gt;
  {
      Context context;
      int layoutResourceId;
      ArrayList&lt;Book&gt; books;
      private SparseBooleanArray mSelectedItemsIds;
  
      public ViewHolderAdapter(Context context, int layoutResourceId, ArrayList&lt;Book&gt; books) {
          super(context, layoutResourceId, books);
          mSelectedItemsIds = new SparseBooleanArray();
          this.layoutResourceId = layoutResourceId;
          this.context = context;
          this.books = books;
      }
  
      public View getView(int position, View convertView, ViewGroup parent) {
          ViewHolder holder;
          if (convertView == null) {
              LayoutInflater inflater = getLayoutInflater();
              convertView = inflater.inflate(R.layout.cart_row, parent, false);
              holder = new ViewHolder();
              holder.title = (TextView) convertView.findViewById(R.id.cart_row_title);
              holder.authors = (TextView) convertView.findViewById(R.id.cart_row_author);
              convertView.setTag(holder);
          } else {
              holder = (ViewHolder) convertView.getTag();
          }
  
          Book book = books.get(position);
  
          holder.title.setText(book.getTitle());
          Log.d(&quot;book size&quot;, books.size() + &quot;&quot;);
          Log.d(&quot;book title&quot;, book.getTitle());
          .
          .
          .
          return convertView;
      }
  
      public void updateList(ArrayList&lt;Book&gt; shoppingCart)
      {
          books = shoppingCart;
          Log.d(&quot;last book&quot;, books.get(books.size()-1).getTitle() + &quot;&quot;);
          notifyDataSetChanged();
      }
  
  }
  }
  </code></pre>
  <p>The issue is that when I <code>updateList</code>, the list does not change. But in the LogCat:</p>
  <blockquote>
  <p>02-06 05:30:43.375 29052-29052/? D/book size: 8</p>
  <p>02-06 05:30:43.375 29052-29052/? D/book title: morning</p>
  <p>02-06 05:30:43.375 29052-29052/? D/book size: 8</p>
  <p>02-06 05:30:43.375 29052-29052/? D/book title: night</p>
  <p>02-06 05:30:43.375 29052-29052/? D/book size: 8</p>
  <p>02-06 05:30:43.375 29052-29052/? D/book title: nice</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book size: 8</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book title: very nice</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book size: 8</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book title: nidaye</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book size: 8</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book title: nima</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book size: 8</p>
  <p>02-06 05:30:43.376 29052-29052/? D/book title: dfd</p>
  </blockquote>
  <p>The <code>book size</code> of the book object is 8, but the <code>book title</code> just display the first seven books, not including the last no which I added. I think the problem maybe lay in <code>position</code>. But cannot figure it out.</p>
  <p>Thanks in advance.</p>