Changing min and max hours
In the project I am working min and max hours will be changing depends on the day. Let say on Monday the min hour is 8 and max hour is 20 and on Tuesday the min hour is 7 and max hour is 19. My calendar mode is day view, when I scroll from Monday to Tuesday the app crashes and it shows the below error.
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.text.StaticLayout.draw(android.graphics.Canvas)' on a null object reference at com.alamkanak.weekview.TimeColumnRenderer$render$1$1.invoke(TimeColumnRenderer.kt:58) at com.alamkanak.weekview.TimeColumnRenderer$render$1$1.invoke(TimeColumnRenderer.kt:7) at com.alamkanak.weekview.CanvasExtensionsKt.withTranslation(CanvasExtensions.kt:11) at com.alamkanak.weekview.TimeColumnRenderer.render(TimeColumnRenderer.kt:57) at com.alamkanak.weekview.WeekView.performRendering(WeekView.kt:132) at com.alamkanak.weekview.WeekView.onDraw(WeekView.kt:106) at android.view.View.draw(View.java:23898) at android.view.View.buildDrawingCacheImpl(View.java:23164) at android.view.View.buildDrawingCache(View.java:23024) at android.view.View.updateDisplayListIfDirty(View.java:22735) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:602) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:608) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:684) at android.view.ViewRootImpl.draw(ViewRootImpl.java:5432) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:5140) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4204) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2911) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10458) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108) at android.view.Choreographer.doCallbacks(Choreographer.java:866) at android.view.Choreographer.doFrame(Choreographer.java:797) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8663) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Changing min and max hours In the project I am working min and max hours will be changing depends on the day. Let say on Monday the min hour is 8 and max hour is 20 and on Tuesday the min hour is 7 and max hour is 19. My calendar mode is day view, when I scroll from Monday to Tuesday the app crashes and it shows the below error.
java.lang.NullPointerException: Attempt to invoke virtual method 'void android.text.StaticLayout.draw(android.graphics.Canvas)' on a null object reference at com.alamkanak.weekview.TimeColumnRenderer$render$1$1.invoke(TimeColumnRenderer.kt:58) at com.alamkanak.weekview.TimeColumnRenderer$render$1$1.invoke(TimeColumnRenderer.kt:7) at com.alamkanak.weekview.CanvasExtensionsKt.withTranslation(CanvasExtensions.kt:11) at com.alamkanak.weekview.TimeColumnRenderer.render(TimeColumnRenderer.kt:57) at com.alamkanak.weekview.WeekView.performRendering(WeekView.kt:132) at com.alamkanak.weekview.WeekView.onDraw(WeekView.kt:106) at android.view.View.draw(View.java:23898) at android.view.View.buildDrawingCacheImpl(View.java:23164) at android.view.View.buildDrawingCache(View.java:23024) at android.view.View.updateDisplayListIfDirty(View.java:22735) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:5339) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:5311) at android.view.View.updateDisplayListIfDirty(View.java:22714) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:602) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:608) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:684) at android.view.ViewRootImpl.draw(ViewRootImpl.java:5432) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:5140) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:4204) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2911) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:10458) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1108) at android.view.Choreographer.doCallbacks(Choreographer.java:866) at android.view.Choreographer.doFrame(Choreographer.java:797) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1092) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8663) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Additional context