Material-calendarview: Redraw calender function?

Created on 20 Oct 2015  路  5Comments  路  Source: prolificinteractive/material-calendarview

Hi,

I'm adding calender items dynamically, however when adding a new item (on a different view pager tab) and returning to the calender, despite calling invalidateDecorators() it will not update and show a dot decorator on the newly entered date?

Thanks!

Most helpful comment

Saying that, it appears i may have a solution, it's a shame to have to do it this way though?

cal.removeDecorators();
cal.addDecorator(new DaySelectorDecorator(getActivity()));
cal.addDecorator(new EventDecorator(getResources().getColor(R.color.ColorPrimaryDark),     realmToCalender(realmHelper.getUserEntries())));

Basically, just remove all the decorators and add them again!

All 5 comments

Hi @xbroak, could you explain further how you are adding items to the calendar?

This could also be because of how you are updating the non-visible tab so I would check that too.

Hi, Sorry about the late response, i am adding items to a Realm database which works fine.

http://share.joescott.me/13db5.png

When reloading the fragment the calender is on, the dots appear as intended, my problem is refreshing the calender dynamically once i've added an item on another screen to the database (and serve an event to the calender to refresh) which calls cal.invalidateDecorators(); however it does not update.

Saying that, it appears i may have a solution, it's a shame to have to do it this way though?

cal.removeDecorators();
cal.addDecorator(new DaySelectorDecorator(getActivity()));
cal.addDecorator(new EventDecorator(getResources().getColor(R.color.ColorPrimaryDark),     realmToCalender(realmHelper.getUserEntries())));

Basically, just remove all the decorators and add them again!

I am also facing the same issue. I have a lot of different types of decorators so @xbroak solution seems too much overhead to implement.

It is working now. The issue was in that emulator instance. running perfectly in another emulator and real device.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dzafiri picture dzafiri  路  3Comments

gibsonndemanga picture gibsonndemanga  路  6Comments

erylljoy24 picture erylljoy24  路  3Comments

Maragues picture Maragues  路  5Comments

Ashtapathy picture Ashtapathy  路  3Comments