Giter Site home page Giter Site logo

Comments (2)

entropitor avatar entropitor commented on May 7, 2024

See this comment

Basically, the first time onMonthChange is called, you call your asyncTask.
When that's completed you save your events somewhere in your activity/fragment/... (somewhere where you can access them synchronously).
After saving the events you call mWeekView.notifyDatasetChanged();
This will trigger another round of onMonthChange() events. Now you have the data, so you can provide it in your return argument.

Notes: you should cache whether you're already loading the events for a specific month too. When the weekview is created, the previous, the current and next month will be loaded (in that order).
So when you call mWeekView.notifyDatasetChanged(); on the completion of the first request, the other 2 might not have finished and will be called again. (Basically, if you don't have this check, the current month will be loaded twice and the next month 3 times).

I suggest this issue to be left open as a reminder that we should update the readme with this explanation or at least a link to a wiki with a page of extra information for async loading.

from android-week-view.

KimPark89 avatar KimPark89 commented on May 7, 2024

Thank you, it works. And I agree with you for updating the readme. I think this is a pretty common problem.

from android-week-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.