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

# PasswordTransformationMethod

*** ** * ** ***

` public class PasswordTransformationMethod `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/text/TextWatcher, https://developer.android.com/reference/android/text/method/TransformationMethod `

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

<br />

*** ** * ** ***

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/text/method/PasswordTransformationMethod#PasswordTransformationMethod()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/text/method/PasswordTransformationMethod#afterTextChanged(android.text.Editable)(https://developer.android.com/reference/android/text/Editable s) ` This method is called to notify you that, somewhere within `s`, the text has been changed. |
| ` void` | ` https://developer.android.com/reference/android/text/method/PasswordTransformationMethod#beforeTextChanged(java.lang.CharSequence,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/CharSequence s, int start, int count, int after) ` This method is called to notify you that, within `s`, the `count` characters beginning at `start` are about to be replaced by new text with length `after`. |
| ` static https://developer.android.com/reference/android/text/method/PasswordTransformationMethod` | ` https://developer.android.com/reference/android/text/method/PasswordTransformationMethod#getInstance()() ` |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/text/method/PasswordTransformationMethod#getTransformation(java.lang.CharSequence,%20android.view.View)(https://developer.android.com/reference/java/lang/CharSequence source, https://developer.android.com/reference/android/view/View view) ` Returns a CharSequence that is a transformation of the source text -- for example, replacing each character with a dot in a password field. |
| ` void` | ` https://developer.android.com/reference/android/text/method/PasswordTransformationMethod#onFocusChanged(android.view.View,%20java.lang.CharSequence,%20boolean,%20int,%20android.graphics.Rect)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/java/lang/CharSequence sourceText, boolean focused, int direction, https://developer.android.com/reference/android/graphics/Rect previouslyFocusedRect) ` This method is called when the TextView that uses this TransformationMethod gains or loses focus. |
| ` void` | ` https://developer.android.com/reference/android/text/method/PasswordTransformationMethod#onTextChanged(java.lang.CharSequence,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/CharSequence s, int start, int before, int count) ` This method is called to notify you that, within `s`, the `count` characters beginning at `start` have just replaced old text that had length `before`. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` 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 https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` 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` ` 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` ` 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*.
From interface ` https://developer.android.com/reference/android/text/TextWatcher ` ` abstract void` ` https://developer.android.com/reference/android/text/TextWatcher#afterTextChanged(android.text.Editable)(https://developer.android.com/reference/android/text/Editable s) `

This method is called to notify you that, somewhere within `s`, the text has been changed.
` abstract void` ` https://developer.android.com/reference/android/text/TextWatcher#beforeTextChanged(java.lang.CharSequence,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/CharSequence s, int start, int count, int after) `

This method is called to notify you that, within `s`, the `count` characters beginning at `start` are about to be replaced by new text with length `after`.
` abstract void` ` https://developer.android.com/reference/android/text/TextWatcher#onTextChanged(java.lang.CharSequence,%20int,%20int,%20int)(https://developer.android.com/reference/java/lang/CharSequence s, int start, int before, int count) `

This method is called to notify you that, within `s`, the `count` characters beginning at `start` have just replaced old text that had length `before`.
From interface ` https://developer.android.com/reference/android/text/method/TransformationMethod ` ` abstract https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/text/method/TransformationMethod#getTransformation(java.lang.CharSequence,%20android.view.View)(https://developer.android.com/reference/java/lang/CharSequence source, https://developer.android.com/reference/android/view/View view) `

Returns a CharSequence that is a transformation of the source text -- for example, replacing each character with a dot in a password field.
` abstract void` ` https://developer.android.com/reference/android/text/method/TransformationMethod#onFocusChanged(android.view.View,%20java.lang.CharSequence,%20boolean,%20int,%20android.graphics.Rect)(https://developer.android.com/reference/android/view/View view, https://developer.android.com/reference/java/lang/CharSequence sourceText, boolean focused, int direction, https://developer.android.com/reference/android/graphics/Rect previouslyFocusedRect) `

This method is called when the TextView that uses this TransformationMethod gains or loses focus.

## Public constructors

### PasswordTransformationMethod

```
public PasswordTransformationMethod ()
```

<br />

<br />

## Public methods

### afterTextChanged

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

```
public void afterTextChanged (Editable s)
```

This method is called to notify you that, somewhere within `s`, the text has been changed. It is legitimate to make further changes to `s` from this callback, but be careful not to get yourself into an infinite loop, because any changes you make will cause this method to be called again recursively. (You are not told where the change took place because other afterTextChanged() methods may already have made other changes and invalidated the offsets. But if you need to know here, you can use `https://developer.android.com/reference/android/text/Spannable#setSpan(java.lang.Object,%20int,%20int,%20int)` in `https://developer.android.com/reference/android/text/TextWatcher#onTextChanged(java.lang.CharSequence,%20int,%20int,%20int)` to mark your place and then look up from here where the span ended up.

<br />

| Parameters ||
|---|---|
| `s` | `Editable` <br /> |

### beforeTextChanged

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

```
public void beforeTextChanged (CharSequence s, 
                int start, 
                int count, 
                int after)
```

This method is called to notify you that, within `s`, the `count` characters beginning at `start` are about to be replaced by new text with length `after`. It is an error to attempt to make changes to `s` from this callback.

<br />

| Parameters ||
|---|---|
| `s` | `CharSequence` <br /> |
| `start` | `int` <br /> |
| `count` | `int` <br /> |
| `after` | `int` <br /> |

### getInstance

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

```
public static PasswordTransformationMethod getInstance ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/text/method/PasswordTransformationMethod` | <br /> |

### getTransformation

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

```
public CharSequence getTransformation (CharSequence source, 
                View view)
```

Returns a CharSequence that is a transformation of the source text -- for example, replacing each character with a dot in a password field. Beware that the returned text must be exactly the same length as the source text, and that if the source text is Editable, the returned text must mirror it dynamically instead of doing a one-time copy. The method should not return `null` unless `source` is `null`.

<br />

| Parameters ||
|---|---|
| `source` | `CharSequence` <br /> |
| `view` | `View` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | <br /> |

### onFocusChanged

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

```
public void onFocusChanged (View view, 
                CharSequence sourceText, 
                boolean focused, 
                int direction, 
                Rect previouslyFocusedRect)
```

This method is called when the TextView that uses this TransformationMethod gains or loses focus.

<br />

| Parameters ||
|---|---|
| `view` | `View` <br /> |
| `sourceText` | `CharSequence` <br /> |
| `focused` | `boolean` <br /> |
| `direction` | `int` <br /> |
| `previouslyFocusedRect` | `Rect` <br /> |

### onTextChanged

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

```
public void onTextChanged (CharSequence s, 
                int start, 
                int before, 
                int count)
```

This method is called to notify you that, within `s`, the `count` characters beginning at `start` have just replaced old text that had length `before`. It is an error to attempt to make changes to `s` from this callback.

<br />

| Parameters ||
|---|---|
| `s` | `CharSequence` <br /> |
| `start` | `int` <br /> |
| `before` | `int` <br /> |
| `count` | `int` <br /> |