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.
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.
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.
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# TextDirectionHeuristicsCompat\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1 \nSummary: [Fields](#lfields) \\| [Inherited Methods](#inhmethods) \\| [\\[Expand All\\]](#) \n\nTextDirectionHeuristicsCompat\n=============================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\n\nfinal\n\nclass\nTextDirectionHeuristicsCompat\n`\n\n\n`\n\nextends Object\n\n\n`\n\n`\n\n\n`\n\n|---|-------------------------------------------------------|\n| java.lang.Object ||\n| ↳ | android.support.v4.text.TextDirectionHeuristicsCompat |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nSome objects that implement TextDirectionHeuristic.\n\nSummary\n-------\n\n| ### Fields ||\n|------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` public static final `[TextDirectionHeuristicCompat](/reference/android/support/v4/text/TextDirectionHeuristicCompat) | [ANYRTL_LTR](/reference/android/support/v4/text/TextDirectionHeuristicsCompat#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. |\n| ` public static final `[TextDirectionHeuristicCompat](/reference/android/support/v4/text/TextDirectionHeuristicCompat) | [FIRSTSTRONG_LTR](/reference/android/support/v4/text/TextDirectionHeuristicsCompat#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. |\n| ` public static final `[TextDirectionHeuristicCompat](/reference/android/support/v4/text/TextDirectionHeuristicCompat) | [FIRSTSTRONG_RTL](/reference/android/support/v4/text/TextDirectionHeuristicsCompat#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. |\n| ` public static final `[TextDirectionHeuristicCompat](/reference/android/support/v4/text/TextDirectionHeuristicCompat) | [LOCALE](/reference/android/support/v4/text/TextDirectionHeuristicsCompat#LOCALE) Force the paragraph direction to the Locale direction. |\n| ` public static final `[TextDirectionHeuristicCompat](/reference/android/support/v4/text/TextDirectionHeuristicCompat) | [LTR](/reference/android/support/v4/text/TextDirectionHeuristicsCompat#LTR) Always decides that the direction is left to right. |\n| ` public static final `[TextDirectionHeuristicCompat](/reference/android/support/v4/text/TextDirectionHeuristicCompat) | [RTL](/reference/android/support/v4/text/TextDirectionHeuristicsCompat#RTL) Always decides that the direction is right to left. |\n\n| ### Inherited methods |\n|-----------------------|---|\n| From class ` java.lang.Object ` |-------------------|-------------------------------| | ` Object` | ` clone() ` | | ` boolean` | ` equals(Object arg0) ` | | ` void` | ` finalize() ` | | ` final Class\u003c?\u003e` | ` getClass() ` | | ` int` | ` hashCode() ` | | ` final void` | ` notify() ` | | ` final void` | ` notifyAll() ` | | ` String` | ` toString() ` | | ` final void` | ` wait(long arg0, int arg1) ` | | ` final void` | ` wait(long arg0) ` | | ` final void` | ` wait() ` | ||\n\nFields\n------\n\n### ANYRTL_LTR\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nTextDirectionHeuristicCompat ANYRTL_LTR\n```\n\nIf the text contains any strong right to left non-format character, determines that the\ndirection is right to left, falling back to left to right if it finds none.\n\n\u003cbr /\u003e\n\n### FIRSTSTRONG_LTR\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nTextDirectionHeuristicCompat FIRSTSTRONG_LTR\n```\n\nDetermines the direction based on the first strong directional character, including bidi\nformat chars, falling back to left to right if it finds none. This is the default behavior\nof the Unicode Bidirectional Algorithm.\n\n\u003cbr /\u003e\n\n### FIRSTSTRONG_RTL\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nTextDirectionHeuristicCompat FIRSTSTRONG_RTL\n```\n\nDetermines the direction based on the first strong directional character, including bidi\nformat chars, falling back to right to left if it finds none. This is similar to the default\nbehavior of the Unicode Bidirectional Algorithm, just with different fallback behavior.\n\n\u003cbr /\u003e\n\n### LOCALE\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nTextDirectionHeuristicCompat LOCALE\n```\n\nForce the paragraph direction to the Locale direction. Falls back to left to right.\n\n\u003cbr /\u003e\n\n### LTR\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nTextDirectionHeuristicCompat LTR\n```\n\nAlways decides that the direction is left to right.\n\n\u003cbr /\u003e\n\n### RTL\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nTextDirectionHeuristicCompat RTL\n```\n\nAlways decides that the direction is right to left.\n\n\u003cbr /\u003e\n\n-\n\n Interfaces\n ----------\n\n - [TextDirectionHeuristicCompat](/reference/android/support/v4/text/TextDirectionHeuristicCompat)\n-\n\n Classes\n -------\n\n - [BidiFormatter](/reference/android/support/v4/text/BidiFormatter)\n - [BidiFormatter.Builder](/reference/android/support/v4/text/BidiFormatter.Builder)\n - [ICUCompat](/reference/android/support/v4/text/ICUCompat)\n - [TextDirectionHeuristicsCompat](/reference/android/support/v4/text/TextDirectionHeuristicsCompat)\n - [TextUtilsCompat](/reference/android/support/v4/text/TextUtilsCompat)"]]