简体   繁体   中英

OnClickListener and changing TextView

I have fragment with ListView. I set onClickListener on the button, and when the button is clicked, one text view in listview element change for example from "0" to "1". But nothing happens, have I refresh fragment or something else to see diference?

You need to call notifyDataSetChanged() from your adapter to reflect any changes in the listview adapter.

public void notifyDataSetChanged () Added in API level 1

Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM