AccessibilityNodeInfo.RangeInfo


public static final class AccessibilityNodeInfo.RangeInfo
extends Object

java.lang.Object
   ↳ android.view.accessibility.AccessibilityNodeInfo.RangeInfo


Information about a node's range of values.

A range has a current value between a minimum and a maximum, such as the position of a seek bar or the progress of a progress bar.

Use Float.NaN for any value that is unknown, and Float.isNaN(float) to check for it. If the range is presently indeterminate, use INDETERMINATE instead.

Summary

Constants

int RANGE_TYPE_FLOAT

Range type: float.

int RANGE_TYPE_INDETERMINATE

Range type: indeterminate.

int RANGE_TYPE_INT

Range type: integer.

int RANGE_TYPE_PERCENT

Range type: percent with values from zero to one hundred.

Fields

public static final AccessibilityNodeInfo.RangeInfo INDETERMINATE

A RangeInfo type used to represent a node which may typically expose range information but is presently in an indeterminate state, such as a ProgressBar representing a loading operation of unknown duration.

Public constructors

RangeInfo(int type, float min, float max, float current)

Creates a new range.

Public methods

float getCurrent()

Gets the current value.

float getMax()

Gets the maximum value.

float getMin()

Gets the minimum value.

int getType()

Gets the range type.

static AccessibilityNodeInfo.RangeInfo obtain(int type, float min, float max, float current)

This method was deprecated in API level 33. Object pooling has been discontinued. Create a new instance using the constructor AccessibilityNodeInfo.RangeInfo.RangeInfo(int,float,float,float) instead.

Inherited methods

Constants

RANGE_TYPE_FLOAT

public static final int RANGE_TYPE_FLOAT

Range type: float.

Constant Value: 1 (0x00000001)

RANGE_TYPE_INDETERMINATE

public static final int RANGE_TYPE_INDETERMINATE

Range type: indeterminate. When using this type, the min, max, and current values used to construct an instance may be ignored.

See also:

Constant Value: 3 (0x00000003)

RANGE_TYPE_INT

public static final int RANGE_TYPE_INT

Range type: integer.

Constant Value: 0 (0x00000000)

RANGE_TYPE_PERCENT

public static final int RANGE_TYPE_PERCENT

Range type: percent with values from zero to one hundred.

Constant Value: 2 (0x00000002)

Fields

INDETERMINATE

public static final AccessibilityNodeInfo.RangeInfo INDETERMINATE

A RangeInfo type used to represent a node which may typically expose range information but is presently in an indeterminate state, such as a ProgressBar representing a loading operation of unknown duration.

Public constructors

RangeInfo

public RangeInfo (int type, 
                float min, 
                float max, 
                float current)

Creates a new range.

A range might have no minimum or maximum, and some of its values might be unknown. For example, use Float.POSITIVE_INFINITY as the maximum of a number picker with no upper limit, and Float.NaN as the maximum of a seek bar until the duration of its media is known.

Parameters
type int: The type of the range.
Value is one of the following:
min float: The minimum value. Use Float.NEGATIVE_INFINITY if the range has no minimum, or Float.NaN if the minimum value is unknown.

max float: The maximum value. Use Float.POSITIVE_INFINITY if the range has no maximum, or Float.NaN if the maximum value is unknown.

current float: The current value. Use Float.NaN if the current value is unknown.

Public methods

getCurrent

public float getCurrent ()

Gets the current value.

Returns
float The current value, or Float.NaN if the current value is unknown.

getMax

public float getMax ()

Gets the maximum value.

Returns
float The maximum value, Float.POSITIVE_INFINITY if no maximum exists, or Float.NaN if the maximum value is unknown.

getMin

public float getMin ()

Gets the minimum value.

Returns
float The minimum value, Float.NEGATIVE_INFINITY if no minimum exists, or Float.NaN if the minimum value is unknown.

getType

public int getType ()

Gets the range type.

Returns
int The range type.
Value is one of the following:

obtain


Deprecated in API level 33
public static AccessibilityNodeInfo.RangeInfo obtain (int type, 
                float min, 
                float max, 
                float current)

This method was deprecated in API level 33.
Object pooling has been discontinued. Create a new instance using the constructor AccessibilityNodeInfo.RangeInfo.RangeInfo(int,float,float,float) instead.

Instantiates a new RangeInfo.

Parameters
type int: The type of the range.
Value is one of the following:
min float: The minimum value. Use Float.NEGATIVE_INFINITY if the range has no minimum, or Float.NaN if the minimum value is unknown.

max float: The maximum value. Use Float.POSITIVE_INFINITY if the range has no maximum, or Float.NaN if the maximum value is unknown.

current float: The current value. Use Float.NaN if the current value is unknown.

Returns
AccessibilityNodeInfo.RangeInfo