{"record":{"id":"1f6c7d908b70067c","repo":"material-components/material-components-android","slug":"the-inactive-and-active-ticks-are-different-colors","errorCode":null,"errorMessage":"The inactive and active ticks are different colors. Use the getTickColorInactive() and getTickColorActive() methods instead.","messagePattern":"The inactive and active ticks are different colors\\. Use the getTickColorInactive\\(\\) and getTickColorActive\\(\\) methods instead\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"lib/java/com/google/android/material/slider/BaseSlider.java","lineNumber":1846,"sourceCode":"    invalidate();\n  }\n\n  /**\n   * Returns the color of the tick if the active and inactive parts aren't different.\n   *\n   * @throws IllegalStateException If {@code tickColorActive} and {@code tickColorInactive} have\n   *     been set to different values.\n   * @see #setTickTintList(ColorStateList)\n   * @see #setTickInactiveTintList(ColorStateList)\n   * @see #setTickActiveTintList(ColorStateList)\n   * @see #getTickInactiveTintList()\n   * @see #getTickActiveTintList()\n   * @attr ref com.google.android.material.R.styleable#Slider_tickColor\n   */\n  @NonNull\n  public ColorStateList getTickTintList() {\n    if (!tickColorInactive.equals(tickColorActive)) {\n      throw new IllegalStateException(\n          \"The inactive and active ticks are different colors. Use the getTickColorInactive() and\"\n              + \" getTickColorActive() methods instead.\");\n    }\n    return tickColorActive;\n  }\n\n  /**\n   * Sets the color of the tick marks.\n   *\n   * @see #setTickInactiveTintList(ColorStateList)\n   * @see #setTickActiveTintList(ColorStateList)\n   * @see #getTickTintList()\n   * @attr ref com.google.android.material.R.styleable#Slider_tickColor\n   */\n  public void setTickTintList(@NonNull ColorStateList tickColor) {\n    setTickInactiveTintList(tickColor);\n    setTickActiveTintList(tickColor);\n  }","sourceCodeStart":1828,"sourceCodeEnd":1864,"githubUrl":"https://github.com/material-components/material-components-android/blob/ac7e18efeefb331850c561faf9ab8bf81d27ba68/lib/java/com/google/android/material/slider/BaseSlider.java#L1828-L1864","documentation":"IllegalStateException thrown by getTickTintList() when the inactive and active tick colors have been set to different ColorStateLists. The unified getter can only return a meaningful value when both halves share one color; otherwise callers must use getTickInactiveTintList() and getTickActiveTintList().","triggerScenarios":"Calling setTickInactiveTintList(a) and setTickActiveTintList(b) with a != b (or setting only app:tickColorInactive/app:tickColorActive differently in XML), then calling getTickTintList().","commonSituations":"Theme code that assumes a single tick color while the design system styles active/inactive ticks differently; generic 'read tint, mutate, re-apply' utilities applied to a Material slider.","solutions":["Use getTickInactiveTintList() and getTickActiveTintList() instead of the combined getter.","Only call getTickTintList() when you know both colors were set from the same source.","If a single color is intended, re-apply it with setTickTintList(color) so both halves match."],"exampleFix":"// before\nColorStateList ticks = slider.getTickTintList(); // throws when they differ\n\n// after\nColorStateList inactive = slider.getTickInactiveTintList();\nColorStateList active = slider.getTickActiveTintList();","handlingStrategy":"validation","validationCode":"ColorStateList inactive = slider.getTickInactiveTintList();\nColorStateList active = slider.getTickActiveTintList();\n// never call getTickTintList() unless you set both via setTickTintList()","typeGuard":null,"tryCatchPattern":"If you must call the combined getter in shared code: try { ... } catch (IllegalStateException e) { /* fall back to the split getters */ }","preventionTips":["Prefer the split getters (Inactive/Active) in generic code.","Only use the combined getter immediately after setTickTintList()."],"tags":["android","slider","material-components","color","api-misuse"],"backgroundTag":null,"analyzedSha":"ac7e18efeefb331850c561faf9ab8bf81d27ba68","analyzedAt":"2026-08-14T15:35:35.735Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}