Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions) Summary: [Nested Classes](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#nestedclasses) \| [Constants](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#constants) \| [Inherited Constants](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#inhconstants) \| [Fields](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#lfields) \| [Ctors](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#pubctors) \| [Methods](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#inhmethods)

# AccessibilityNodeInfo.SelectionPosition

*** ** * ** ***


`
public
static
final

class
AccessibilityNodeInfo.SelectionPosition
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.accessibility.AccessibilityNodeInfo.SelectionPosition |

<br />

*** ** * ** ***

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

- `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.Selection`

## Summary

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

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_CHILD` The offset represents a position between the children of this position's node, used with `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getChild(int)`. |
| `int` | `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT` The offset represents an index into the text returned by `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getText()`. |

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

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


`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: 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)`".


| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition>` | `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#CREATOR` |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#SelectionPosition(android.view.accessibility.AccessibilityNodeInfo,%20int)(https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo node, int offset) ` Instantiates a new SelectionPosition. |
| ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#SelectionPosition(android.view.View,%20int)(https://developer.android.com/reference/android/view/View view, int offset) ` Instantiates a new SelectionPosition. |
| ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#SelectionPosition(android.view.View,%20int,%20int)(https://developer.android.com/reference/android/view/View view, int virtualDescendantId, int offset) ` Instantiates a new `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition`. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` boolean` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object other) ` Indicates whether some other object is "equal to" this one. |
| ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getNode()() ` Gets the node for `this` `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition` **Note:** This api can only be called from `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService`. |
| ` int` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getOffset()() ` Gets the offset for `this` `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition`. |
| ` int` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getOffsetType()() ` Returns the offset type. |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getView()() ` Gets the view for `this` `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition` **Note:** Cannot be called from an `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService`. |
| ` int` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getVirtualDescendantId()() ` Gets the virtual descendant id for `this` `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition`. |
| ` int` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#hashCode()() ` Returns a hash code value for the object. |
| ` void` | ` https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Flatten this object in to a Parcel. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

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


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


From interface `

https://developer.android.com/reference/android/os/Parcelable

` `
abstract


int` `
https://developer.android.com/reference/android/os/Parcelable#describeContents()()
`

Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.


`
abstract


void` `
https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags)
`

Flatten this object in to a Parcel.


## Constants

### OFFSET_TYPE_CHILD

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int OFFSET_TYPE_CHILD
```

The offset represents a position between the children of this position's node, used with
`https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo#getChild(int)`. The offset bounds are from 0 to
`https://developer.android.com/reference/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.

<br />

Constant Value:

1
(0x00000001)


### OFFSET_TYPE_TEXT

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final int OFFSET_TYPE_TEXT
```

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

<br />

Constant Value:

0
(0x00000000)


## Fields

### CREATOR

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public static final Creator<AccessibilityNodeInfo.SelectionPosition> CREATOR
```

<br />

<br />

**See also:**

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

## Public constructors

### SelectionPosition

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public SelectionPosition (AccessibilityNodeInfo node, 
                int offset)
```

Instantiates a new SelectionPosition.


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

<br />

| Parameters ||
|---|---|
| `node` | `AccessibilityNodeInfo`: The `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo` for the node of this selection. This value cannot be `null`. <br /> |
| `offset` | `int`: The offset for a `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition` within `view`'s text content, which should be a value between 0 and the length of `view`'s text. <br /> |

### SelectionPosition

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public SelectionPosition (View view, 
                int offset)
```

Instantiates a new SelectionPosition.


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

<br />

| Parameters ||
|---|---|
| `view` | `View`: The `https://developer.android.com/reference/android/view/View` containing the text associated with this selection position. This value cannot be `null`. <br /> |
| `offset` | `int`: 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. <br /> |

### SelectionPosition

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public SelectionPosition (View view, 
                int virtualDescendantId, 
                int offset)
```

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


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

<br />

| Parameters ||
|---|---|
| `view` | `View`: The view whose virtual descendant is associated with the selection position. This value cannot be `null`. <br /> |
| `virtualDescendantId` | `int`: The ID of the virtual descendant within `view`'s virtual subtree that contains the selection position. <br /> |
| `offset` | `int`: 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. <br /> |

**See also:**

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

## Public methods

### describeContents

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int describeContents ()
```

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/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | 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/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### equals

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public boolean equals (Object other)
```

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.

<br />

| Parameters ||
|---|---|
| `other` | `Object`: the reference object with which to compare. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if this object is the same as the obj argument; `false` otherwise. <br /> |

### getNode

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public AccessibilityNodeInfo getNode ()
```

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

**Note:** This api can only be called from `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo` | The node associated with `this` `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition` This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | If not called from an accessibility service. |

### getOffset

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int getOffset ()
```

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

<br />

| Returns ||
|---|---|
| `int` | A value from 0 to the length of `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#getNode()`'s content representing the offset of the `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition` <br /> |

### getOffsetType

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int getOffsetType ()
```

Returns the offset type.

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

<br />

| Returns ||
|---|---|
| `int` | Value is one of the following: - `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_TEXT` - `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition#OFFSET_TYPE_CHILD` |

### getView

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

```
public View getView ()
```

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

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

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | The view associated with `this` `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition`. Will return null if the view is not attached to a window. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/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#ApiLevels)

```
public int getVirtualDescendantId ()
```

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

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

<br />

| Returns ||
|---|---|
| `int` | A value representing the virtual descendant id of the `https://developer.android.com/reference/android/view/accessibility/AccessibilityNodeInfo.SelectionPosition` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | If called from an accessibility service. |

### hashCode

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public int hashCode ()
```

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/java/util/HashMap`.


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/java/lang/Object#equals(java.lang.Object)` 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/java/lang/Object#equals(java.lang.Object)` 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.

<br />

<br />

| Returns ||
|---|---|
| `int` | a hash code value for this object. <br /> |

### writeToParcel

Added in [version 36.1](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: This value cannot be `null`. <br /> |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE` |