muraee / Horizontal-Calendar

A material horizontal calendar view for Android based on RecyclerView
Apache License 2.0
1.21k stars 230 forks source link

androidx RecyclerView #129

Open HananMohamedMaiyas opened 4 years ago

HananMohamedMaiyas commented 4 years ago

import android.support.annotation.Nullable; import android.support.v7.widget.LinearSnapHelper; import android.support.v7.widget.RecyclerView;

Expected Behavior /

scroll throw days

Actual Behavior

application crash when i scroll to left or right i'm using androidx it shows in run java.lang.NullPointerException: Attempt to invoke virtual method 'void devs.mulham.horizontalcalendar.utils.HorizontalCalendarListener.onDateSelected(java.util.Calendar, int)' on a null object reference at devs.mulham.horizontalcalendar.utils.HorizontalSnapHelper.notifyCalendarListener(HorizontalSnapHelper.java:46) at devs.mulham.horizontalcalendar.utils.HorizontalSnapHelper.findSnapView(HorizontalSnapHelper.java:37) at androidx.recyclerview.widget.SnapHelper.snapToTargetExistingView(SnapHelper.java:189) at androidx.recyclerview.widget.SnapHelper$1.onScrollStateChanged(SnapHelper.java:51) at androidx.recyclerview.widget.RecyclerView.dispatchOnScrollStateChanged(RecyclerView.java:5210) at androidx.recyclerview.widget.RecyclerView.setScrollState(RecyclerView.java:1550) at androidx.recyclerview.widget.RecyclerView$ViewFlinger.run(RecyclerView.java:5397) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:871) at android.view.Choreographer.doCallbacks(Choreographer.java:683) at android.view.Choreographer.doFrame(Choreographer.java:616) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:857) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6313) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:872) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:762)

1. 2. 3.

Specifications

  • Android Version:
  • Horizontal-Calendar Version:
CollinsGichuki commented 2 years ago

@HananMohamedMaiyas did you find a fix for this?

aruns2896 commented 2 years ago

Use onDateSelected method to resolve like below horizontalCalendar.setCalendarListener(new HorizontalCalendarListener() { @Override public void onDateSelected(Calendar date, int position) { } });