# TextDirectionHeuristics

Added in[API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Fields](https://developer.android.com/reference/android/text/TextDirectionHeuristics#lfields)\|[Ctors](https://developer.android.com/reference/android/text/TextDirectionHeuristics#pubctors)\|[Inherited Methods](https://developer.android.com/reference/android/text/TextDirectionHeuristics#inhmethods)  

# TextDirectionHeuristics

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/text/TextDirectionHeuristics "View this page in Kotlin")\|Java

`
public


class
TextDirectionHeuristics
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

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

<br />

*** ** * ** ***

Some objects that implement[TextDirectionHeuristic](https://developer.android.com/reference/android/text/TextDirectionHeuristic). Use these with the[unicodeWrap()](https://developer.android.com/reference/android/text/BidiFormatter#unicodeWrap(java.lang.CharSequence))methods in[BidiFormatter](https://developer.android.com/reference/android/text/BidiFormatter). Also notice that these direction heuristics correspond to the same types of constants provided in the[View](https://developer.android.com/reference/android/view/View)class for[setTextDirection()](https://developer.android.com/reference/android/view/View#setTextDirection(int)), such as[View.TEXT_DIRECTION_RTL](https://developer.android.com/reference/android/view/View#TEXT_DIRECTION_RTL).

To support versions lower than[Build.VERSION_CODES.JELLY_BEAN_MR2](https://developer.android.com/reference/android/os/Build.VERSION_CODES#JELLY_BEAN_MR2), you can use the support library's[TextDirectionHeuristicsCompat](https://developer.android.com/reference/androidx/core/text/TextDirectionHeuristicsCompat.html)class.

## Summary

|                                                                                                                                                                                               ### Fields                                                                                                                                                                                                ||
|------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[TextDirectionHeuristic](https://developer.android.com/reference/android/text/TextDirectionHeuristic) | [ANYRTL_LTR](https://developer.android.com/reference/android/text/TextDirectionHeuristics#ANYRTL_LTR) If the text contains any strong right to left non-format character, determines that the direction is right to left, falling back to left to right if it finds none. |
| ` public static final `[TextDirectionHeuristic](https://developer.android.com/reference/android/text/TextDirectionHeuristic) | [FIRSTSTRONG_LTR](https://developer.android.com/reference/android/text/TextDirectionHeuristics#FIRSTSTRONG_LTR) Determines the direction based on the first strong directional character, including bidi format chars, falling back to left to right if it finds none.    |
| ` public static final `[TextDirectionHeuristic](https://developer.android.com/reference/android/text/TextDirectionHeuristic) | [FIRSTSTRONG_RTL](https://developer.android.com/reference/android/text/TextDirectionHeuristics#FIRSTSTRONG_RTL) Determines the direction based on the first strong directional character, including bidi format chars, falling back to right to left if it finds none.    |
| ` public static final `[TextDirectionHeuristic](https://developer.android.com/reference/android/text/TextDirectionHeuristic) | [LOCALE](https://developer.android.com/reference/android/text/TextDirectionHeuristics#LOCALE) Force the paragraph direction to the Locale direction.                                                                                                                      |
| ` public static final `[TextDirectionHeuristic](https://developer.android.com/reference/android/text/TextDirectionHeuristic) | [LTR](https://developer.android.com/reference/android/text/TextDirectionHeuristics#LTR) Always decides that the direction is left to right.                                                                                                                               |
| ` public static final `[TextDirectionHeuristic](https://developer.android.com/reference/android/text/TextDirectionHeuristic) | [RTL](https://developer.android.com/reference/android/text/TextDirectionHeuristics#RTL) Always decides that the direction is right to left.                                                                                                                               |

|                                                           ### Public constructors                                                            ||
|-------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[TextDirectionHeuristics](https://developer.android.com/reference/android/text/TextDirectionHeuristics#TextDirectionHeuristics())`() ` |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Fields

### ANYRTL_LTR

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

```
public static final TextDirectionHeuristic ANYRTL_LTR
```

If the text contains any strong right to left non-format character, determines that the direction is right to left, falling back to left to right if it finds none.

<br />

### FIRSTSTRONG_LTR

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

```
public static final TextDirectionHeuristic FIRSTSTRONG_LTR
```

Determines the direction based on the first strong directional character, including bidi format chars, falling back to left to right if it finds none. This is the default behavior of the Unicode Bidirectional Algorithm.

<br />

### FIRSTSTRONG_RTL

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

```
public static final TextDirectionHeuristic FIRSTSTRONG_RTL
```

Determines the direction based on the first strong directional character, including bidi format chars, falling back to right to left if it finds none. This is similar to the default behavior of the Unicode Bidirectional Algorithm, just with different fallback behavior.

<br />

### LOCALE

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

```
public static final TextDirectionHeuristic LOCALE
```

Force the paragraph direction to the Locale direction. Falls back to left to right.

<br />

### LTR

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

```
public static final TextDirectionHeuristic LTR
```

Always decides that the direction is left to right.

<br />

### RTL

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

```
public static final TextDirectionHeuristic RTL
```

Always decides that the direction is right to left.

<br />

## Public constructors

### TextDirectionHeuristics

```
public TextDirectionHeuristics ()
```

<br />

<br />