Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# SelectionPosition

*** ** * ** ***

```
class SelectionPosition : Parcelable
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.view.accessibility.AccessibilityNodeInfo.SelectionPosition](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#) |

A class which defines either the start or end of a selection that can span across multiple AccessibilityNodeInfo objects.

## Summary

| Nested classes ||
|---|---|
|   | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition.Builder` Builder for creating `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#` objects. |

| Constants ||
|---|---|
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_CHILD:kotlin.Int` The offset represents a position between the children of this position's node, used with `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo#getChild(kotlin.Int)`. |
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT:kotlin.Int` The offset represents an index into the text returned by `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo#getText()`. |

Inherited constants From class `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#` `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int`


Descriptor bit used with `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.

<br />

`https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int`


Flag for use with `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point.

<br />

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#SelectionPosition(android.view.accessibility.AccessibilityNodeInfo,%20kotlin.Int)(node: https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo, offset: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Instantiates a new SelectionPosition. |
| `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#SelectionPosition(android.view.View,%20kotlin.Int)(view: https://developer.android.com/reference/kotlin/android/view/View.html#, offset: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Instantiates a new SelectionPosition. |
| `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#SelectionPosition(android.view.View,%20kotlin.Int,%20kotlin.Int)(view: https://developer.android.com/reference/kotlin/android/view/View.html#, virtualDescendantId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, offset: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Instantiates a new `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`. |

| Public methods ||
|---|---|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#describeContents()()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#equals(kotlin.Any)(other: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html?)` Indicates whether some other object is "equal to" this one. |
| [AccessibilityNodeInfo](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo)? | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getNode()()` Gets the node for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#` **Note:** This api can only be called from `https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.html#`. |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getOffset()()` Gets the offset for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`. |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getOffsetType()()` Returns the offset type. |
| [View](https://developer.android.com/reference/kotlin/android/view/View.html#)? | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getView()()` Gets the view for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#` |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getVirtualDescendantId()()` Gets the virtual descendant id for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`. |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#hashCode()()` Returns a hash code value for the object. |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#writeToParcel(android.os.Parcel,%20kotlin.Int)(dest: https://developer.android.com/reference/kotlin/android/os/Parcel.html#, flags: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Flatten this object in to a Parcel. |

| Properties ||
|---|---|
| static [Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[AccessibilityNodeInfo.SelectionPosition](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#)!\> | `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#CREATOR:android.os.Parcelable.Creator` <br /> |

## Constants

### OFFSET_TYPE_CHILD

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val OFFSET_TYPE_CHILD: Int
```

The offset represents a position between the children of this position's node, used with `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo#getChild(kotlin.Int)`. The offset bounds are from 0 to `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo#getChildCount()`, inclusive. An offset of 0 represents the position conceptually before the first child, and an offset equal to the child count represents the position after the last child.

    Value: 1

### OFFSET_TYPE_TEXT

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val OFFSET_TYPE_TEXT: Int
```

The offset represents an index into the text returned by `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo#getText()`.

    Value: 0

## Public constructors

### SelectionPosition

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
SelectionPosition(
    node: AccessibilityNodeInfo, 
    offset: Int)
```

Instantiates a new SelectionPosition.

`https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getOffsetType()` will default to `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT:kotlin.Int`.

| Parameters ||
|---|---|
| `node` | [AccessibilityNodeInfo](https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo): The `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo` for the node of this selection. This value cannot be `null`. |
| `offset` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The offset for a `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#` within `view`'s text content, which should be a value between 0 and the length of `view`'s text. |

### SelectionPosition

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
SelectionPosition(
    view: View, 
    offset: Int)
```

Instantiates a new SelectionPosition.

`https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getOffsetType()` will default to `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT:kotlin.Int`.

| Parameters ||
|---|---|
| `view` | [View](https://developer.android.com/reference/kotlin/android/view/View.html#): The `https://developer.android.com/reference/kotlin/android/view/View.html#` containing the text associated with this selection position. This value cannot be `null`. |
| `offset` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The offset for a selection position within `view`'s text content, which should be a value between 0 and the length of `view`'s text. |

### SelectionPosition

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
SelectionPosition(
    view: View, 
    virtualDescendantId: Int, 
    offset: Int)
```

Instantiates a new `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`.

`https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getOffsetType()` will default to `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT:kotlin.Int`.

| Parameters ||
|---|---|
| `view` | [View](https://developer.android.com/reference/kotlin/android/view/View.html#): The view whose virtual descendant is associated with the selection position. This value cannot be `null`. |
| `virtualDescendantId` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The ID of the virtual descendant within `view`'s virtual subtree that contains the selection position. |
| `offset` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The offset for a selection position within the virtual descendant's text content, which should be a value between 0 and the length of the descendant's text. |

**See Also**

- `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeProvider`

## Public methods

### describeContents

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun describeContents(): Int
```

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)`, the return value of this method must include the `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` bit.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int` |

### equals

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun equals(other: Any?): Boolean
```

Indicates whether some other object is "equal to" this one.

The `equals` method implements an equivalence relation on non-null object references:

- It is *reflexive* : for any non-null reference value `x`, `x.equals(x)` should return `true`.
- It is *symmetric* : for any non-null reference values `x` and `y`, `x.equals(y)` should return `true` if and only if `y.equals(x)` returns `true`.
- It is *transitive* : for any non-null reference values `x`, `y`, and `z`, if `x.equals(y)` returns `true` and `y.equals(z)` returns `true`, then `x.equals(z)` should return `true`.
- It is *consistent* : for any non-null reference values `x` and `y`, multiple invocations of `x.equals(y)` consistently return `true` or consistently return `false`, provided no information used in `equals` comparisons on the objects is modified.
- For any non-null reference value `x`, `x.equals(null)` should return `false`.

An equivalence relation partitions the elements it operates on into *equivalence classes*; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

| Parameters ||
|---|---|
| `obj` | the reference object with which to compare. |

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html` | `true` if this object is the same as the obj argument; `false` otherwise. |

### getNode

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getNode(): AccessibilityNodeInfo?
```

Gets the node for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`   
**Note:** This api can only be called from `https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.html#`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo?` | The node associated with `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#` This value may be `null`. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | If not called from an accessibility service. |

### getOffset

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getOffset(): Int
```

Gets the offset for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | A value from 0 to the length of `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getNode()`'s content representing the offset of the `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#` |

### getOffsetType

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getOffsetType(): Int
```

Returns the offset type. If this instance was created without specifying an offset type, this will default to `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT:kotlin.Int`.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | Value is one of the following: - `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT:kotlin.Int` - `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_CHILD:kotlin.Int` |

### getView

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getView(): View?
```

Gets the view for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`

**Note:** Cannot be called from an `https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.html#`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/view/View.html#?` | The view associated with `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`. Will return null if the view is not attached to a window. |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | If called from an accessibility service. |

### getVirtualDescendantId

Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun getVirtualDescendantId(): Int
```

Gets the virtual descendant id for `this` `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#`.

**Note:** Cannot be called from an `https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.html#`.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | A value representing the virtual descendant id of the `https://developer.android.com/reference/kotlin/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#` |

| Exceptions ||
|---|---|
| `java.lang.IllegalStateException` | If called from an accessibility service. |

### hashCode

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun hashCode(): Int
```

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by `https://developer.android.com/reference/kotlin/java/util/HashMap.html#`.

The general contract of `hashCode` is:

- Whenever it is invoked on the same object more than once during an execution of a Java application, the `hashCode` method must consistently return the same integer, provided no information used in `equals` comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
- If two objects are equal according to the `https://developer.android.com/reference/kotlin/java/lang/Object.html#equals(kotlin.Any)` method, then calling the `hashCode` method on each of the two objects must produce the same integer result.
- It is *not* required that if two objects are unequal according to the `https://developer.android.com/reference/kotlin/java/lang/Object.html#equals(kotlin.Any)` method, then calling the `hashCode` method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | a hash code value for this object. |

### writeToParcel

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
```

Flatten this object in to a Parcel.

| Parameters ||
|---|---|
| `dest` | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#): This value cannot be `null`. |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int` |

## Properties

### CREATOR

Added in [API level 36.1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val CREATOR: Parcelable.Creator<AccessibilityNodeInfo.SelectionPosition!>
```
**See Also**

- `https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#`