How to use the TextWatcher class in Android?

前端 未结 9 1017
独厮守ぢ
独厮守ぢ 2020-11-22 02:30

Can anyone tell me how to mask the substring in EditText or how to change EditText substring input to password type

9条回答
  •  温柔的废话
    2020-11-22 02:49

    For Kotlin use KTX extension function: (It uses TextWatcher as previous answers)

    yourEditText.doOnTextChanged { text, start, count, after -> 
            // action which will be invoked when the text is changing
        }
    


    import core-KTX:

    implementation "androidx.core:core-ktx:1.2.0"
    

提交回复
热议问题