views:

30

answers:

1

I've just added a header to my ListView and I have to change a bunch of code because the header essentially becomes position 0 (Meaning the Cursor indices of my CursorAdapter do not line up with the indicies of the list. They are off by 1 now). Why? This seems a bit silly to me.

The only reason I can come up with is that a developer may want to access the header. Fine. Provide something like getListView().getHeader().

A: 

I believe a ListView is nothing more than a list of View elements. If you add a header (or a footer for that matter, it shouldn't make any difference) to your ListView, that element is basically no different from any of the other elements that gets added automatically through the ListAdapter. The only minor difference being that the header (and footer) element will be fixed and stay unaffected by what the ListAdapter does with the list - they are still nothing but ordinary elements though.

Nailuj