title: IndexOutOfBoundsException in my Android Listview adapter
body: <p>I keep getting this IndexOutOfBoundsException, but can't seem to figure out what's causing it. My listview has an adapter with a list of objects, and the objects are removed based on a timestamp. The removal is done inside the getView method. Once an item is removed, I call notifyDataSetChanged().</p>
  
  <p>The full source code is available on github, and here's a link to the listview adapter code: <a href="https://github.com/kenneho/run-for-the-bus/blob/master/app/src/main/java/net/kenneho/runnow/adapters/TravelsAdapter.java" rel="nofollow">https://github.com/kenneho/run-for-the-bus/blob/master/app/src/main/java/net/kenneho/runnow/adapters/TravelsAdapter.java</a></p>
  
  <p>This is the beginning of the stacktrace I keep getting:</p>
  
  <pre><code>java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
  at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
  at java.util.ArrayList.get(ArrayList.java:308)
  at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:164)
  at android.widget.ListView.dispatchDraw(ListView.java:3307)
  at android.view.View.draw(View.java:15213)
  &lt;snip&gt;
  </code></pre>
  
  <p>I see that often the position-value within getView can get as high as six or seven. </p>
  
  <p>Can anyone here spot the bug? Any help will be appreciated. </p>
  
  <p>Regards, 
  Kenneth </p>
  
  <p>EDIT 1:
  * Link to the activity code that uses the : <a href="https://github.com/kenneho/run-for-the-bus/blob/master/app/src/main/java/net/kenneho/runnow/InfoActivity.java" rel="nofollow">https://github.com/kenneho/run-for-the-bus/blob/master/app/src/main/java/net/kenneho/runnow/InfoActivity.java</a>
  * I've pasted the most relevant logcat part here: <a href="http://pastebin.com/5FtU4EaM" rel="nofollow">http://pastebin.com/5FtU4EaM</a></p>