android.text
Stay organized with collections
Save and categorize content based on your preferences.
Interfaces
Editable |
This is the interface for text whose content and markup
can be changed (as opposed
to immutable text like Strings). |
GetChars |
Please implement this interface if your CharSequence has a
getChars() method like the one in String that is faster than
calling charAt() multiple times. |
InputFilter |
InputFilters can be attached to Editable s to constrain the
changes that can be made to them. |
InputType |
Bit definitions for an integer defining the basic content type of text
held in an Editable object. |
NoCopySpan |
This interface should be added to a span object that should not be copied
into a new Spenned when performing a slice or copy operation on the original
Spanned it was placed in. |
Spannable |
This is the interface for text to which markup objects can be
attached and detached. |
Spanned |
This is the interface for text that has markup objects attached to
ranges of it. |
SpanWatcher |
When an object of this type is attached to a Spannable, its methods
will be called to notify it that other markup objects have been
added, changed, or removed. |
TextUtils.StringSplitter |
An interface for splitting strings according to rules that are opaque to the user of this
interface. |
TextWatcher |
When an object of a type is attached to an Editable, its methods will
be called when the text is changed. |
Classes
Enums
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003eThe Android text framework provides interfaces and classes for manipulating text, including handling editable text, input filtering, and markup objects.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eEditable\u003c/code\u003e and \u003ccode\u003eSpannable\u003c/code\u003e are key interfaces for text that can be changed and have markup attached, respectively.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eSpannableString\u003c/code\u003e and \u003ccode\u003eSpannableStringBuilder\u003c/code\u003e are classes for immutable and mutable text with markup support.\u003c/p\u003e\n"],["\u003cp\u003eInputFilters such as \u003ccode\u003eInputFilter.AllCaps\u003c/code\u003e and \u003ccode\u003eInputFilter.LengthFilter\u003c/code\u003e control changes made to editable text.\u003c/p\u003e\n"],["\u003cp\u003eUtility classes like \u003ccode\u003eSelection\u003c/code\u003e and \u003ccode\u003eTextUtils\u003c/code\u003e offer methods for cursor management, string operations, and more.\u003c/p\u003e\n"]]],["The document defines interfaces, classes, and enums for handling text manipulation. Key interfaces include `Editable` (for changeable text), `Spannable` (for attaching markup), `Spanned` (for text with markup), `InputFilter` (for constraining edits), `SpanWatcher` (for tracking markup changes), `GetChars`, and `TextWatcher`(for tracking text changes). `NoCopySpan` prevents span copying. Classes like `SpannableString`, `SpannedString`, and `SpannableStringBuilder` provide different text mutability. `InputFilter.AllCaps` and `InputFilter.LengthFilter` are specific edit constraints, and `TextUtils` offers string utility functions.\n"],null,["# android.text\n\n### Interfaces\n\n|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Editable](../../../reference/android/text/Editable.html) | This is the interface for text whose content and markup can be changed (as opposed to immutable text like Strings). |\n| [GetChars](../../../reference/android/text/GetChars.html) | Please implement this interface if your CharSequence has a getChars() method like the one in String that is faster than calling charAt() multiple times. |\n| [InputFilter](../../../reference/android/text/InputFilter.html) | InputFilters can be attached to [Editable](../../../reference/android/text/Editable.html)s to constrain the changes that can be made to them. |\n| [InputType](../../../reference/android/text/InputType.html) | Bit definitions for an integer defining the basic content type of text held in an [Editable](../../../reference/android/text/Editable.html) object. |\n| [NoCopySpan](../../../reference/android/text/NoCopySpan.html) | This interface should be added to a span object that should not be copied into a new Spenned when performing a slice or copy operation on the original Spanned it was placed in. |\n| [Spannable](../../../reference/android/text/Spannable.html) | This is the interface for text to which markup objects can be attached and detached. |\n| [Spanned](../../../reference/android/text/Spanned.html) | This is the interface for text that has markup objects attached to ranges of it. |\n| [SpanWatcher](../../../reference/android/text/SpanWatcher.html) | When an object of this type is attached to a Spannable, its methods will be called to notify it that other markup objects have been added, changed, or removed. |\n| [TextUtils.StringSplitter](../../../reference/android/text/TextUtils.StringSplitter.html) | An interface for splitting strings according to rules that are opaque to the user of this interface. |\n| [TextWatcher](../../../reference/android/text/TextWatcher.html) | When an object of a type is attached to an Editable, its methods will be called when the text is changed. |\n\n### Classes\n\n|-------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|\n| [Editable.Factory](../../../reference/android/text/Editable.Factory.html) | Factory used by TextView to create new Editables. |\n| [InputFilter.AllCaps](../../../reference/android/text/InputFilter.AllCaps.html) | This filter will capitalize all the lower case letters that are added through edits. |\n| [InputFilter.LengthFilter](../../../reference/android/text/InputFilter.LengthFilter.html) | This filter will constrain edits not to make the length of the text greater than the specified length. |\n| [NoCopySpan.Concrete](../../../reference/android/text/NoCopySpan.Concrete.html) | Convenience equivalent for when you would just want a new Object() for a span but want it to be no-copy. |\n| [Selection](../../../reference/android/text/Selection.html) | Utility class for manipulating cursors and selections in CharSequences. |\n| [Spannable.Factory](../../../reference/android/text/Spannable.Factory.html) | Factory used by TextView to create new Spannables. |\n| [SpannableString](../../../reference/android/text/SpannableString.html) | This is the class for text whose content is immutable but to which markup objects can be attached and detached. |\n| [SpannableStringBuilder](../../../reference/android/text/SpannableStringBuilder.html) | This is the class for text whose content and markup can both be changed. |\n| [SpannedString](../../../reference/android/text/SpannedString.html) | This is the class for text whose content and markup are immutable. |\n| [TextUtils](../../../reference/android/text/TextUtils.html) | |\n| [TextUtils.SimpleStringSplitter](../../../reference/android/text/TextUtils.SimpleStringSplitter.html) | A simple string splitter. |\n\n### Enums\n\n|-----------------------------------------------------------------------------------|---|\n| [TextUtils.TruncateAt](../../../reference/android/text/TextUtils.TruncateAt.html) | |"]]