title: Infinite call to "onScroll" when reach end of grid view
body: <p>I've found the following code to do something when I reach the end of a gridview:</p>
  
  <pre><code>    GridView gridview = (YMAnimatedGridview) v.findViewById(R.id.my_gridview);
      gridview.setAdapter(adapter);
      final View footerView = mainView
              .findViewById(R.id.my_grid_footer_view);
      gridview.setOnScrollListener(new GridView.OnScrollListener() {
  
      @Override
      public void onScroll(AbsListView view, int firstVisibleItem,
              int visibleItemCount, int totalItemCount) {
  
              if (firstVisibleItem + visibleItemCount == totalItemCount) {
  
                  // last item in grid is on the screen, show footer:
                  fetchMoreItems();
  
              } 
          }
  
      @Override
      public void onScrollStateChanged(AbsListView view, int scrollState) {
      }
  </code></pre>
  
  <p>The thing is that, when I reach the end of the gridView, this method is called continously.</p>
  
  <pre><code>private void fetchMoreItems() {
      Log.i(LOG_TAG, "Reached the end of grid view"); //for debbug purposes
      Integer lastIndex = thumbnails.length; //This is a Bitmap array with the data I'm alredy showing
      Cursor cursor = getData();
      thumbnails = concat(thumbnails, new Bitmap[30]);
      Integer lastIndexToRun = Math.min(30, cursor.getCount() - lastIndex);
      for(int j = 0; j &lt; lastIndexToRun; j++) {
          Integer i = j + lastIndex;
          cursor.moveToPosition(i);
          thumbnails[i] = getThumbnail(i);
      }
      adapter.notifyDataSetChanged(); //This is the adapter used to fill the gridview
      cursor.close();
  }
  </code></pre>
  
  <p>I think my mistake should be in the fetchMoreItems() method, but since it's my first time using GridView, I'm not sure</p>