"Bug resolution" call pageradapter.notifydatasetchanged () does not update

Source: Internet
Author: User

    • Problem description

Android develops an ad display page that supports swipe left and right to refresh the display after the data is loaded

Call madapter.notifydatasetchanged () to promote the hair but no effect

    • Problem investigation

Instantiateitem () is not triggered after notifydatasetchanged ()

    • Problem modification

The return value of getitemposition determines whether the Instantiateitem is updated @Override public int GetItemPosition (Object object) {return POS    Ition_none; }


    • Principle Analysis


    • GetItemPosition ()

      • The function is used to return the position of the given object, which is the return value of Instantiateitem ().

      • The return value of the function is judged in viewpager.datasetchanged () to determine whether the Pageradapter.instantiateitem () function will eventually be triggered.

      • The implementation in Pageradapter is directly passed back to position_unchanged. If the function is not overloaded, it will always return position_unchanged, causing viewpager.datasetchanged () to be called when it is not necessary to trigger Pageradapter.instantiateitem (). Many people cause the call to occur because the function is not overloaded
        After pageradapter.notifydatasetchanged (), nothing happened.


    • Reference website

Http://www.apkbus.com/android-90417-1-1.html


"Bug resolution" call pageradapter.notifydatasetchanged () does not update

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.