kzotin
kzotin

Reputation: 5365

How to update Listview's headerView when Cursor is updated?

I have a ListView with headerView, data is held by custom CursorAdapter:

View headerView = mInflater.inflate(R.layout.list_header_item, null);
mListView.addHeaderView(headerView);

mAdapter = new NewsCursorAdapter(this, getItemsCursor());
mListView.setAdapter(mAdapter);
//here do some header initialization from cursor

Could you please advice how to update header when cursor is changed? The problem is that data is populated from WebService, and not always exists onCreate()

ListView items are updated perfectly.

Upvotes: 2

Views: 1701

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006674

You have to do this yourself. Whatever code is updating the Cursor will need to arrange to update your headerView as well.

Upvotes: 1

Related Questions