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

# UsernameFilterGeneric

*** ** * ** ***

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

```
open class UsernameFilterGeneric : LoginFilter
```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||
| ↳ | [android.text.LoginFilter](https://developer.android.com/reference/kotlin/android/text/LoginFilter) ||
|   | ↳ | [android.text.LoginFilter.UsernameFilterGeneric](https://developer.android.com/reference/kotlin/android/text/LoginFilter.UsernameFilterGeneric#) |

*** ** * ** ***

| **This class was deprecated in API level 30.**
|
| Deprecated in Java.

This filter rejects characters in the user name that are not compatible with Google login. It is slightly less restrictive than the above filter in that it allows \[a-zA-Z0-9._-+\].

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/text/LoginFilter.UsernameFilterGeneric#UsernameFilterGeneric()()` <br /> |
| `https://developer.android.com/reference/kotlin/android/text/LoginFilter.UsernameFilterGeneric#UsernameFilterGeneric(kotlin.Boolean)(appendInvalid: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` <br /> |

| Public methods ||
|---|---|
| open [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `https://developer.android.com/reference/kotlin/android/text/LoginFilter.UsernameFilterGeneric#isAllowed(kotlin.Char)(c: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html)` Returns whether or not we allow character c. |

| Inherited functions ||
|---|---|
| From class `https://developer.android.com/reference/kotlin/android/text/LoginFilter` |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!` | `https://developer.android.com/reference/kotlin/android/text/LoginFilter#filter(kotlin.CharSequence,%20kotlin.Int,%20kotlin.Int,%20android.text.Spanned,%20kotlin.Int,%20kotlin.Int)(source: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html!, start: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, end: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, dest: https://developer.android.com/reference/kotlin/android/text/Spanned!, dstart: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, dend: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` This method is called when the buffer is going to replace the range `dstart ... dend` of `dest` with the new text from the range `start ... end` of `source`. Returns the CharSequence that we want placed there instead, including an empty string if appropriate, or `null` to accept the original replacement. Be careful to not to reject 0-length replacements, as this is what happens when you delete text. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/android/text/LoginFilter#onInvalidCharacter(kotlin.Char)(c: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char/index.html)` Called whenever we encounter an invalid character. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/android/text/LoginFilter#onStart()()` Called when we start processing filter. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/android/text/LoginFilter#onStop()()` Called when we're done processing filter <br /> | ||

## Public constructors

### UsernameFilterGeneric

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

```
UsernameFilterGeneric()
```

### UsernameFilterGeneric

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

```
UsernameFilterGeneric(appendInvalid: Boolean)
```

## Public methods

### isAllowed

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

```
open fun isAllowed(c: Char): Boolean
```

**Deprecated:** *Deprecated in Java.*

Returns whether or not we allow character c. Subclasses must override this method.