Stay organized with collections
Save and categorize content based on your preferences.
AutoCompleteTextView.Validator
public
static
interface
AutoCompleteTextView.Validator
android.widget.AutoCompleteTextView.Validator
|
This interface is used to make sure that the text entered in this TextView complies to
a certain format. Since there is no foolproof way to prevent the user from leaving
this View with an incorrect value in it, all we can do is try to fix it ourselves
when this happens.
Summary
Public methods
fixText
public abstract CharSequence fixText (CharSequence invalidText)
Corrects the specified text to make it valid.
Parameters |
invalidText |
CharSequence : A string that doesn't pass validation: isValid(invalidText)
returns false |
Returns |
CharSequence |
A string based on invalidText such as invoking isValid() on it returns true. |
isValid
public abstract boolean isValid (CharSequence text)
Validates the specified text.
Parameters |
text |
CharSequence |
Returns |
boolean |
true If the text currently in the text editor is valid. |
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,["# AutoCompleteTextView.Validator\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nAutoCompleteTextView.Validator\n==============================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/widget/AutoCompleteTextView.Validator \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nAutoCompleteTextView.Validator\n`\n\n\n`\n\n\n`\n\n|-----------------------------------------------|\n| android.widget.AutoCompleteTextView.Validator |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThis interface is used to make sure that the text entered in this TextView complies to\na certain format. Since there is no foolproof way to prevent the user from leaving\nthis View with an incorrect value in it, all we can do is try to fix it ourselves\nwhen this happens.\n\nSummary\n-------\n\n| ### Public methods ||\n|---------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract `[CharSequence](/reference/java/lang/CharSequence) | ` `[fixText](/reference/android/widget/AutoCompleteTextView.Validator#fixText(java.lang.CharSequence))`(`[CharSequence](/reference/java/lang/CharSequence)` invalidText) ` Corrects the specified text to make it valid. |\n| ` abstract boolean` | ` `[isValid](/reference/android/widget/AutoCompleteTextView.Validator#isValid(java.lang.CharSequence))`(`[CharSequence](/reference/java/lang/CharSequence)` text) ` Validates the specified text. |\n\nPublic methods\n--------------\n\n### fixText\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract CharSequence fixText (CharSequence invalidText)\n```\n\nCorrects the specified text to make it valid.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|--------------------------------------------------------------------------------------------------|\n| `invalidText` | `CharSequence`: A string that doesn't pass validation: isValid(invalidText) returns false \u003cbr /\u003e |\n\n| Returns ||\n|---------------------------------------------------|-------------------------------------------------------------------------------------|\n| [CharSequence](/reference/java/lang/CharSequence) | A string based on invalidText such as invoking isValid() on it returns true. \u003cbr /\u003e |\n\n**See also:**\n\n- [isValid(CharSequence)](/reference/android/widget/AutoCompleteTextView.Validator#isValid(java.lang.CharSequence)) \n\n### isValid\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean isValid (CharSequence text)\n```\n\nValidates the specified text.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|--------|-----------------------|\n| `text` | `CharSequence` \u003cbr /\u003e |\n\n| Returns ||\n|-----------|----------------------------------------------------------------|\n| `boolean` | true If the text currently in the text editor is valid. \u003cbr /\u003e |\n\n**See also:**\n\n- [fixText(CharSequence)](/reference/android/widget/AutoCompleteTextView.Validator#fixText(java.lang.CharSequence))"]]