title: Android List View Scrolling Issue
body: <p>Hello everyone I am beginner in Android Programming, and fresh developer too, In my android project I got one issue in the below scenario,<br>
   I have some list with huge items and this list  has  scroller, when start scrolling at particular point in the middle of list the program crashes and asks to force close.. The logcat says it s due to ArrayIndexOutOfBounds Exception, I'm not sure what modification should be done for this.. Any body please help me, if it is known issue.. </p>
  
  <p>my code.. </p>
  
  <pre><code>@Override
  public boolean areAllItemsEnabled() {
      return false;
  }
  
  @Override
  public boolean isEnabled(int position) {
      return true;
  }
  
  public int getCount() {
      if (_UiRows != null)
          return _UiRows.size();
      return 0;
  }
  
  public Object getItem(int position) {
      return _UiRows.get(position);
  }
  
  // This function essentially disabled the flyweight caching by giving every row a unique type
  // This works because we end up saving refreshes and thereby reducing GC 
  public int getItemViewType(int position) {
      if (_UiRows == null)
          return 0;
  
      return position;
  }
  
  public int getViewTypeCount() {
      return 100; // Max edit rows
  }
  
  public long getItemId(int position) {
      return position;
  }
  
  public EditRowView getNewView(Context ctx) {
      return new EditRowView(ctx);
  }
  
  private EditViewProvider findCustomViewProvider(EditRowData row) {
      for (EditViewProvider p : _CustomViewProviders) {
          if (p.isCustomView(row))
              return p;
      }
      return null;
  }
  
  public View getView(int position, View convertView, ViewGroup parent) {
      EditRowView v = null;
      EditRowData row = (EditRowData) _UiRows.get(position);
  
      // NOTE: 
      // ListItemType starting at 0
      // Invisible -2 for hidden ones
      // Custom types starting at VIEWTYPE_CUSTOM_OFFSET, registered via RegisterCustomViewProvider
  
      // Create a view based on view type
      EditViewProvider viewProvider = findCustomViewProvider(row);
      if (row.IsVisible() == false) {
          return new View(parent.getContext());
      } else if (viewProvider != null) {
          return viewProvider.getView(row, convertView, parent);
      } else {
          // TODO: (Phase II) This area could use some refactoring to handle various types individually. 
          // Currently app types are handled by EditRowView, using more memory than necessary
          if (convertView != null &amp;&amp; convertView instanceof EditRowView) {
              v = (EditRowView) convertView;
          } else {
              v = getNewView(parent.getContext());
              v.SetParent(this);
              v.SetBusinessLogic(_BL);
          }
  
          v.BindDataItem(row);
      }
  
      return v;
  }
  </code></pre>
  
  <p>logcat snippet...</p>
  
  <pre><code>&gt; 11-25 16:08:08.667: E/IR-ProcessUIRequest(859): Request:
  &gt; TruckStatusTable, Action:  11-25 16:08:08.797: D/AndroidRuntime(859):
  &gt; Shutting down VM 11-25 16:08:08.797: W/dalvikvm(859): threadid=1:
  &gt; thread exiting with uncaught exception (group=0x40015560) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859): FATAL EXCEPTION: main 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):
  &gt; java.lang.ArrayIndexOutOfBoundsException 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:4540)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.ListView.measureHeightOfChildren(ListView.java:1228)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.ListView.onMeasure(ListView.java:1127) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.view.View.measure(View.java:8313) 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.FrameLayout.onMeasure(FrameLayout.java:250) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.view.View.measure(View.java:8313) 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1017)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.LinearLayout.measureVertical(LinearLayout.java:386)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.LinearLayout.onMeasure(LinearLayout.java:309) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.view.View.measure(View.java:8313) 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.FrameLayout.onMeasure(FrameLayout.java:250) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.view.View.measure(View.java:8313) 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; android.widget.FrameLayout.onMeasure(FrameLayout.java:250) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.view.View.measure(View.java:8313) 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; android.view.ViewRoot.performTraversals(ViewRoot.java:839) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.view.ViewRoot.handleMessage(ViewRoot.java:1859) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.os.Handler.dispatchMessage(Handler.java:99) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; android.os.Looper.loop(Looper.java:123) 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; android.app.ActivityThread.main(ActivityThread.java:3683) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; java.lang.reflect.Method.invokeNative(Native Method) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; java.lang.reflect.Method.invoke(Method.java:507) 11-25 16:08:08.918:
  &gt; E/AndroidRuntime(859):    at
  &gt; com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
  &gt; 11-25 16:08:08.918: E/AndroidRuntime(859):    at
  &gt; com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 11-25
  &gt; 16:08:08.918: E/AndroidRuntime(859):  at
  &gt; dalvik.system.NativeStart.main(Native Method) 11-25 16:08:09.277:
  &gt; D/dalvikvm(859): GC_CONCURRENT freed 519K, 38% free 5281K/8455K,
  &gt; external 547K/1046K, paused 8ms+19ms 11-25 16:08:09.517:
  &gt; I/dalvikvm(859): Jit: resizing JitTable from 1024 to 2048
  </code></pre>