How to call notifyDataSetChanged() from a generic Adapter
Posted
by Matty F
on Stack Overflow
See other posts from Stack Overflow
or by Matty F
Published on 2010-05-19T16:27:38Z
Indexed on
2010/05/19
16:30 UTC
Read the original article
Hit count: 335
An OnItemClickListener
for a ListView
has the following method:
@Override
public void onItemClick(AdapterView<?> parent, View v, int position, long id)
I'd like to have the adapter behind the ListView
refresh, and I believe this is done through the use of:
BaseAdapter.notifyDataSetChanged()
How do I use the parent
parameter in the onItemClick
method to do this? So far I've tried:
parent.getAdapter().notifyDataSetChanged();
This throws an error because the object returned is of class HeaderViewListAdapter
, which for reasons unknown isn't a subclass of BaseAdapter
.
© Stack Overflow or respective owner