Refresh ListView if I changed the contents of ListItem

I have a ListView in my Android activity. And I populate the ListView with a subclass of BaseAdaptor (which returns the View method in getView ()).

What should I do if in my click listener there are buttons in the list item view I

  • change the text of the textview in the list view or
  • resize the view of the list item by adding / removing children of the list of list items.

What is effective for updating my list? I do not want listView to re-run the request because there are no data changes.

Thank.

+3
source share
2 answers

If you just change the contents of your child view, you do not need to do more than that TextView.setText(newText).

ListView, BaseAdaptor.notifyDataSetChanged()

+5

, invalidate(), , , - - . , ( reset) OnDraw()

0

Source: https://habr.com/ru/post/1737103/


All Articles