I put a button in a listview item, the onclicklistener was set in the getView() method of the adpter. The adapter is an individual class file extends BaseAdapter. And by the onclick event of the button, the data set of the listview is changed, how can I refresh the listview in the adapter?

I can not call adpter.notifyDataSetChanged() method in the getView() method of the adapter.

And now I am using broadcast to notify the listview in ***Activity.class. However, I dont think it is a good idea. Then, how to make it?

有帮助吗?

解决方案

Can you add something like

AdapterClass.this.notifyDataSetchanged()

to your onClickListener within the getView() method?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top