erikwt/PullToRefresh-ListView

ClassCastException android.widget.HeaderViewListAdapter using CustomAdapter

Closed this issue · 1 comments

I'm getting this error when I perform the refreshing of the list.

First, when the activity is created, in the onResume() method I populate my custom adapter for the list, and everything goes smooth. The list is populated and I'm able to interact with it.
Then, if I make the drag movement to refresh the list, I get this error when retrieving the list adapter in order to refresh it. I post the code below:

private void refreshListAdapter() {
NewsListAdapter adapter = (NewsListAdapter)ptrList.getAdapter();
if (adapter == null) {
adapter = new NewsListAdapter(NewsActivity.this);
ptrList.setAdapter(adapter);
} else {
adapter.populateAdapter();
}
ptrList.onRefreshComplete();
}

Is not possible to use custom adapters or have them to extend from HeaderViewListAdapter?

Can you help me? Thank you in advance.

David.

Hi David,

I don't think this is a PullToRefresh-ListView problem. This ListView does not override getAdapter() from ListView, so I think your problem is more general.

Erik