Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/view/FocusFinder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/FocusFinder#inhmethods)

# FocusFinder

*** ** * ** ***


`
public


class
FocusFinder
`


`

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


`

`


`

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

<br />

*** ** * ** ***

The algorithm used for finding the next focusable view in a given direction
from a view that currently has focus.

## Summary

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/view/FocusFinder#findNearestTouchable(android.view.ViewGroup,%20int,%20int,%20int,%20int[])(https://developer.android.com/reference/android/view/ViewGroup root, int x, int y, int direction, int[] deltas) ` Find the nearest touchable view to the specified view. |
| ` final https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/view/FocusFinder#findNextFocus(android.view.ViewGroup,%20android.view.View,%20int)(https://developer.android.com/reference/android/view/ViewGroup root, https://developer.android.com/reference/android/view/View focused, int direction) ` Find the next view to take focus in root's descendants, starting from the view that currently is focused. |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/view/FocusFinder#findNextFocusFromRect(android.view.ViewGroup,%20android.graphics.Rect,%20int)(https://developer.android.com/reference/android/view/ViewGroup root, https://developer.android.com/reference/android/graphics/Rect focusedRect, int direction) ` Find the next view to take focus in root's descendants, searching from a particular rectangle in root's coordinates. |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/view/FocusFinder#findNextKeyboardNavigationCluster(android.view.View,%20android.view.View,%20int)(https://developer.android.com/reference/android/view/View root, https://developer.android.com/reference/android/view/View currentCluster, int direction) ` Find the root of the next keyboard navigation cluster after the current one. |
| ` static https://developer.android.com/reference/android/view/FocusFinder` | ` https://developer.android.com/reference/android/view/FocusFinder#getInstance()() ` Get the focus finder for this thread. |

### 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*.


## Public methods

### findNearestTouchable

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

```
public View findNearestTouchable (ViewGroup root, 
                int x, 
                int y, 
                int direction, 
                int[] deltas)
```

Find the nearest touchable view to the specified view.

<br />

| Parameters ||
|---|---|
| `root` | `ViewGroup`: The root of the tree in which to search <br /> |
| `x` | `int`: X coordinate from which to start the search <br /> |
| `y` | `int`: Y coordinate from which to start the search <br /> |
| `direction` | `int`: Direction to look <br /> |
| `deltas` | `int`: Offset from the to the edge of the nearest view. Note that this array may already be populated with values. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | The nearest touchable view, or null if none exists. <br /> |

### findNextFocus

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

```
public final View findNextFocus (ViewGroup root, 
                View focused, 
                int direction)
```

Find the next view to take focus in root's descendants, starting from the view
that currently is focused.

If `focused` is not part of the active focusable sequence (for example, if it is
an accessibility focus node that is not capable of taking input focus), this method falls
back to a generic entry behavior for relative focus navigation (`https://developer.android.com/reference/android/view/View#FOCUS_FORWARD`,
`https://developer.android.com/reference/android/view/View#FOCUS_BACKWARD`), returning the first or last focusable view in the hierarchy
respectively.

For absolute directional navigation (`https://developer.android.com/reference/android/view/View#FOCUS_LEFT`, `https://developer.android.com/reference/android/view/View#FOCUS_RIGHT`,
`https://developer.android.com/reference/android/view/View#FOCUS_UP`, `https://developer.android.com/reference/android/view/View#FOCUS_DOWN`), this method always uses the `focused`
view's bounding rectangle as the geometric starting point for the spatial search, regardless
of whether the view is included in the focusable sequence.

<br />

| Parameters ||
|---|---|
| `root` | `ViewGroup`: Contains focused. Cannot be null. <br /> |
| `focused` | `View`: Has focus now. <br /> |
| `direction` | `int`: Direction to look. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | The next focusable view, or null if none exists. <br /> |

### findNextFocusFromRect

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

```
public View findNextFocusFromRect (ViewGroup root, 
                Rect focusedRect, 
                int direction)
```

Find the next view to take focus in root's descendants, searching from
a particular rectangle in root's coordinates.

<br />

| Parameters ||
|---|---|
| `root` | `ViewGroup`: Contains focusedRect. Cannot be null. <br /> |
| `focusedRect` | `Rect`: The starting point of the search. <br /> |
| `direction` | `int`: Direction to look. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | The next focusable view, or null if none exists. <br /> |

### findNextKeyboardNavigationCluster

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

```
public View findNextKeyboardNavigationCluster (View root, 
                View currentCluster, 
                int direction)
```

Find the root of the next keyboard navigation cluster after the current one.

<br />

| Parameters ||
|---|---|
| `root` | `View`: The view tree to look inside. Cannot be null <br /> |
| `currentCluster` | `View`: The starting point of the search. Null means the default cluster. This value may be `null`. <br /> |
| `direction` | `int`: Direction to look. Value is one of the following: - `https://developer.android.com/reference/android/view/View#FOCUS_BACKWARD` - `https://developer.android.com/reference/android/view/View#FOCUS_FORWARD` - `https://developer.android.com/reference/android/view/View#FOCUS_LEFT` - `https://developer.android.com/reference/android/view/View#FOCUS_UP` - `https://developer.android.com/reference/android/view/View#FOCUS_RIGHT` - `https://developer.android.com/reference/android/view/View#FOCUS_DOWN` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | The next cluster, or null if none exists <br /> |

### getInstance

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

```
public static FocusFinder getInstance ()
```

Get the focus finder for this thread.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/FocusFinder` | <br /> |