lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey

ReplacementTransformationMethod

public abstract class ReplacementTransformationMethod
extends Object implements TransformationMethod

java.lang.Object
   ↳ android.text.method.ReplacementTransformationMethod


This transformation method causes the characters in the getOriginal() array to be replaced by the corresponding characters in the getReplacement() array.

Summary

Public constructors

ReplacementTransformationMethod()

Public methods

CharSequence getTransformation(CharSequence source, View v)

Returns a CharSequence that will mirror the contents of the source CharSequence but with the characters in getOriginal() replaced by ones from getReplacement().

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.

Protected methods

abstract char[] getOriginal()

Returns the list of characters that are to be replaced by other characters when displayed.

abstract char[] getReplacement()

Returns a parallel array of replacement characters for the ones that are to be replaced.

Inherited methods

Public constructors

ReplacementTransformationMethod

added in API level 1
public ReplacementTransformationMethod ()

Public methods

getTransformation

added in API level 1
public CharSequence getTransformation (CharSequence source, 
                View v)

Returns a CharSequence that will mirror the contents of the source CharSequence but with the characters in getOriginal() replaced by ones from getReplacement().

Parameters
source CharSequence

v View

Returns
CharSequence

onFocusChanged

added in API level 1
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.

Parameters
view View

sourceText CharSequence

focused boolean

direction int

previouslyFocusedRect Rect

Protected methods

getOriginal

added in API level 1
protected abstract char[] getOriginal ()

Returns the list of characters that are to be replaced by other characters when displayed.

Returns
char[]

getReplacement

added in API level 1
protected abstract char[] getReplacement ()

Returns a parallel array of replacement characters for the ones that are to be replaced.

Returns
char[]