What is the difference between notifydatasetinvalidated () and notifydatasetchanged () in Android programs?

Source: Internet
Author: User

The Notifydatasetchanged method controls how the contents of each item are refreshed by forcing calls to GetView if the contents of the adapter are changed by an external method.

public void notifydatasetchanged ()

The method internally implements the invocation of the OnChanged event on top of each observer. This method is called whenever a change in the data set is found, or when a new state of the data is read.

For example, in Sina Weibo, we want to make a display to refresh the Weibo.

public void notifydatasetinvalidated ()

The method internally implements the invocation of the Oninvalidated event on top of each observer. This method is called whenever a data set monitoring change is found, such as if the dataset is no longer valid.

For example, if the data source fails, call notifydatasetinvalidated ()

Notifydatasetinvalidated (), redraw the control (revert to initial state)
Notifydatasetchanged (), redraw the currently visible area

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.