abstract class ReplacementTransformationMethod : TransformationMethod

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

Summary

Public constructors
Public methods
open CharSequence!

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

open Unit

onFocusChanged(view: View!, sourceText: CharSequence!, focused: Boolean, direction: Int, previouslyFocusedRect: Rect!)

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

Protected methods
abstract CharArray!

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

abstract CharArray!

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

Public constructors

ReplacementTransformationMethod

ReplacementTransformationMethod()

Public methods

getTransformation

open fun getTransformation(
    source: CharSequence!,
    v: View!
): CharSequence!

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

onFocusChanged

open fun onFocusChanged(
    view: View!,
    sourceText: CharSequence!,
    focused: Boolean,
    direction: Int,
    previouslyFocusedRect: Rect!
): Unit

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

Protected methods

getOriginal

protected abstract fun getOriginal(): CharArray!

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

getReplacement

protected abstract fun getReplacement(): CharArray!

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

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 2026-02-13 UTC.