Fatal Exception: java.lang.IllegalArgumentException: tickCount less than 2; invalid tickCount.
ericntd opened this issue · comments
Eric Nguyen commented
My code:
rangeSliderPrice.setTickStart(0);
rangeSliderPrice.setTickEnd(10000);
rangeSliderPrice.setRangePinsByValue(0, 10000);
if (filterPriceRangeItem.mMaxPrice > filterPriceRangeItem.mMinPrice) {
rangeSliderPrice.setTickStart(filterPriceRangeItem.mMinPrice);
rangeSliderPrice.setTickEnd(filterPriceRangeItem.mMaxPrice);
}
Stacktrace
Understanding the DEFAULT_TICK_START is 0 and DEFAULT_TICK_END is 5, I've had the following:
rangeSliderPrice.setTickStart(0);
rangeSliderPrice.setTickEnd(10000);
rangeSliderPrice.setRangePinsByValue(0, 10000);
if (filterPriceRangeItem.mMaxPrice > filterPriceRangeItem.mMinPrice) {
rangeSliderPrice.setTickStart(filterPriceRangeItem.mMinPrice);
rangeSliderPrice.setTickEnd(filterPriceRangeItem.mMaxPrice);
}
But the crash still happens!
What I'm missing?
Fatal Exception: java.lang.IllegalArgumentException: tickCount less than 2; invalid tickCount.
at com.appyvet.rangebar.RangeBar.setTickStart(RangeBar.java:545)
at com.xxx.digital.views.fragments.filter.AbstractFilterFragment$FilterPriceRangeItemViewHolder.bind(AbstractFilterFragment.java:256)
at com.xxx.digital.views.fragments.filter.AbstractFilterFragment$FilterListAdapter.onBindViewHolder(AbstractFilterFragment.java:421)
at com.xxx.digital.views.fragments.filter.AbstractFilterFragment$FilterListAdapter.onBindViewHolder(AbstractFilterFragment.java:383)
at android.support.v7.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:6067)
at android.support.v7.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:6100)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5282)
at android.support.v7.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:5158)
at android.support.v7.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2061)
at android.support.v7.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1445)
at android.support.v7.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1408)
at android.support.v7.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:580)
at android.support.v7.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:3379)
at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:3188)
at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3632)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.RelativeLayout.onLayout(RelativeLayout.java:1077)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1702)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1556)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1465)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:16695)
at android.view.ViewGroup.layout(ViewGroup.java:5328)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2319)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2032)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
at android.view.Choreographer.doCallbacks(Choreographer.java:590)
at android.view.Choreographer.doFrame(Choreographer.java:560)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5942)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
HasanShaikh commented
I am also getting the same error, when i set
rangeSliderPrice.setTickStart(100);
rangeSliderPrice.setTickEnd(10000);
so did any one found any solution for this.
Gabriel Rotaru commented
@ericn37 @HasanShaikh
Check the RangeBar view in your xml file. Maybe attributes custom:tickStart and custom:tickEnd are already set in the xml
Karan Datwani commented
@HasanShaikh
@RGabi
The Solution is
set end first then set start
rangeSliderPrice.setTickEnd(10000);
rangeSliderPrice.setTickStart(100);
Marcelo Romero commented
@karandatwani92 great! Work it!
Ali Ansari commented
@karandatwani92 Thanks. But it should be documented at somewhere.
Jonas commented
It works :)
Asad Mahmood commented
@karandatwani92 It works!