Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when user clicks on date outside current month #54

Closed
ebabel opened this issue Mar 30, 2017 · 2 comments
Closed

NPE when user clicks on date outside current month #54

ebabel opened this issue Mar 30, 2017 · 2 comments

Comments

@ebabel
Copy link

ebabel commented Mar 30, 2017

http://imgur.com/a/d6uKs
When clicking on the bottom "5" before clicking on a date within the current month, the following NPE occurs.
java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.p_v.flexiblecalendar.entity.SelectedDateItem.equals(java.lang.Object)' on a null object reference at com.p_v.flexiblecalendar.MonthViewPagerAdapter.refreshUserSelectedItem(MonthViewPagerAdapter.java:210) at com.p_v.flexiblecalendar.FlexibleCalendarView$MonthChangeListener.onPageSelected(FlexibleCalendarView.java:326) at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1939) at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:687) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:671) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:632) at android.support.v4.view.ViewPager.setCurrentItem(ViewPager.java:624) at com.antonyt.infiniteviewpager.InfiniteViewPager.setCurrentItem(InfiniteViewPager.java:48)

@badadin
Copy link

badadin commented Mar 31, 2017

Try to select some date after you initialized calendar view. Something like this:

Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(new Date().getTime());

flexibleCalendarView.selectDate(calendar.get(Calendar.YEAR),
    calendar.get(Calendar.MONTH),
    calendar.get(Calendar.DAY_OF_MONTH));

@p-v
Copy link
Owner

p-v commented Aug 9, 2017

Feel free to reopen if there is any confusion.

@p-v p-v closed this as completed Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants