{"record":{"id":"a6670b6ce8a76d89","repo":"material-components/material-components-android","slug":"the-continuousmodetickcount-s-must-be-greater-th","errorCode":null,"errorMessage":"The continuousModeTickCount(%s) must be greater than or equal to 0","messagePattern":"The continuousModeTickCount\\((.+?)\\) must be greater than or equal to 0","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"lib/java/com/google/android/material/slider/BaseSlider.java","lineNumber":1056,"sourceCode":"  public int getContinuousModeTickCount() {\n    return continuousModeTickCount;\n  }\n\n  /**\n   * Sets the number of ticks to display in continuous mode. Default is 0.\n   *\n   * <p>This allows for showing purely visual ticks in continuous mode.\n   *\n   * <p>Setting this value to a negative value will result in an {@link IllegalArgumentException}.\n   *\n   * @param continuousModeTickCount The number of ticks that must be drawn in continuous mode count\n   * @throws IllegalArgumentException If the continuous mode tick count is less than 0\n   * @see #getContinuousModeTickCount()\n   * @attr ref com.google.android.material.R.styleable#Slider_continuousModeTickCount\n   */\n  public void setContinuousModeTickCount(int continuousModeTickCount) {\n    if (continuousModeTickCount < 0) {\n      throw new IllegalArgumentException(\n          String.format(EXCEPTION_ILLEGAL_CONTINUOUS_MODE_TICK_COUNT, continuousModeTickCount));\n    }\n    if (this.continuousModeTickCount != continuousModeTickCount) {\n      this.continuousModeTickCount = continuousModeTickCount;\n      dirtyConfig = true;\n      postInvalidate();\n    }\n  }\n\n  /**\n   * Sets the custom thumb drawable which will be used for all value positions. Note that the custom\n   * drawable provided will be resized to match the thumb radius set by {@link #setThumbRadius(int)}\n   * or {@link #setThumbRadiusResource(int)}. Be aware that the image quality may be compromised\n   * during resizing.\n   *\n   * @see #setCustomThumbDrawable(Drawable)\n   * @see #setCustomThumbDrawablesForValues(int...)\n   * @see #setCustomThumbDrawablesForValues(Drawable...)","sourceCodeStart":1038,"sourceCodeEnd":1074,"githubUrl":"https://github.com/material-components/material-components-android/blob/ac7e18efeefb331850c561faf9ab8bf81d27ba68/lib/java/com/google/android/material/slider/BaseSlider.java#L1038-L1074","documentation":"IllegalArgumentException thrown synchronously by setContinuousModeTickCount(int) when a negative count is passed. continuousModeTickCount draws purely visual ticks in continuous mode (stepSize 0); negative counts are meaningless and rejected immediately.","triggerScenarios":"Calling setContinuousModeTickCount(-1) or app:continuousModeTickCount with a negative value; deriving the count from data (e.g. item count - 1) that can go negative.","commonSituations":"Using -1 as a sentinel for 'no ticks' instead of 0; off-by-one computations like itemCount - 2 on a list of size 1.","solutions":["Use 0 to disable continuous-mode ticks instead of a negative sentinel.","Math.max(0, computedTickCount) before calling the setter.","Audit app:continuousModeTickCount in XML for negative literals."],"exampleFix":"// before\nslider.setContinuousModeTickCount(tickCount - 2); // -1 when tickCount == 1\n\n// after\nslider.setContinuousModeTickCount(Math.max(0, tickCount - 2));","handlingStrategy":"validation","validationCode":"slider.setContinuousModeTickCount(Math.max(0, tickCount));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use 0 to disable visual ticks, never a negative sentinel.","Watch off-by-one math (count - 2) on small lists."],"tags":["android","slider","material-components","validation","immediate"],"backgroundTag":null,"analyzedSha":"ac7e18efeefb331850c561faf9ab8bf81d27ba68","analyzedAt":"2026-08-14T15:35:35.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}