Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
    
    RangeTemplate
    class RangeTemplate : ControlTemplate
    
    A template for a Control with inputs in a "continuous" range of values.
    Summary
    
      
        
          | Inherited constants | 
        
        
          
            From class ControlTemplate
              
                
                  
                    Int | 
                    TYPE_ERROR
                      
                         Type identifier of the template returned by getErrorTemplate().   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                  
                    Int | 
                    TYPE_NO_TEMPLATE
                      
                         Type identifier of ControlTemplate.getNoTemplateObject.   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                  
                    Int | 
                    TYPE_RANGE
                      
                         Type identifier of RangeTemplate.   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                  
                    Int | 
                    TYPE_STATELESS
                      
                         Type identifier of StatelessTemplate.   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                  
                    Int | 
                    TYPE_TEMPERATURE
                      
                         Type identifier of TemperatureControlTemplate.   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                  
                    Int | 
                    TYPE_THUMBNAIL
                      
                         Type identifier of ThumbnailTemplate.   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                  
                    Int | 
                    TYPE_TOGGLE
                      
                         Type identifier of ToggleTemplate.   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                  
                    Int | 
                    TYPE_TOGGLE_RANGE
                      
                         Type identifier of ToggleRangeTemplate.   Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS 
                      
                     | 
                   
                
               
             
           | 
        
      
    
    
    
      
        
          | Public methods | 
        
        
          | Float | 
          
            
             The current value for this range. 
           | 
        
        
          | CharSequence | 
          
            
             Formatter for generating a user visible String representing the value returned by RangeTemplate.getCurrentValue. 
           | 
        
        
          | Float | 
          
            
             The maximum value for this range. 
           | 
        
        
          | Float | 
          
            
             The minimum value for this range. 
           | 
        
        
          | Float | 
          
            
             The value of the smallest increment or decrement that can be performed on this range. 
           | 
        
        
          | Int | 
          
            
            
           | 
        
      
    
    
    Public constructors
    
      RangeTemplate
      
      RangeTemplate(
    templateId: String, 
    minValue: Float, 
    maxValue: Float, 
    currentValue: Float, 
    stepValue: Float, 
    formatString: CharSequence?)
      Construct a new RangeTemplate. The range must be valid, meaning: 
        
 
          -  
minValue < maxValue  
          -  
minValue < currentValue  
          -  
currentValue < maxValue  
          -  0 < 
stepValue  
        
 
       The current value of the Control will be formatted accordingly.
      
        
          
            | Parameters | 
          
          
            templateId | 
            String: the identifier for this template object This value cannot be null. | 
          
          
            minValue | 
            Float: minimum value for the input | 
          
          
            maxValue | 
            Float: maximum value for the input | 
          
          
            currentValue | 
            Float: the current value of the Control containing this object. | 
          
          
            stepValue | 
            Float: minimum value of increments/decrements when interacting with this control. | 
          
          
            formatString | 
            CharSequence?: a formatting string as per java.lang.String#format used to display the currentValue. If null is passed, the "%.1f" is used. | 
          
        
      
      
        
          
            | Exceptions | 
          
          
            java.lang.IllegalArgumentException | 
            if the parameters passed do not make a valid range. | 
          
        
      
     
    Public methods
    
      getCurrentValue
      
      fun getCurrentValue(): Float
      The current value for this range.
     
    
    
      getMaxValue
      
      fun getMaxValue(): Float
      The maximum value for this range.
     
    
      getMinValue
      
      fun getMinValue(): Float
      The minimum value for this range.
     
    
      getStepValue
      
      fun getStepValue(): Float
      The value of the smallest increment or decrement that can be performed on this range.
     
    
      getTemplateType
      
      fun getTemplateType(): Int
      
     
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.