TextWatcher in Kotlin Android Usage

TextWatcher in Kotlin

TextWatcher in Kotlin is a useful class provided by the Android Developer API. Text watcher watches an input text field and you can instantly update data on other views. It can be useful for counting the number of characters entered in the text field instantly and measuring password strength on entering etc. TextWatcher is explained with an example and video tutorial, Here you will get a complete idea about text watcher.

Usage of Text Watcher in Kotlin | Android Studio

Code for Text Watcher in Kotlin

package com.googlecraft.textwatcher

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.text.Editable
import android.text.TextWatcher
import android.widget.Button
import android.widget.EditText

class MainActivity : AppCompatActivity() {
    lateinit var inputtext :EditText
    lateinit var action_button: Button

    override fun onCreate(savedInstanceState: Bundle?) {


        inputtext.addTextChangedListener(object : TextWatcher
            override fun afterTextChanged(p0: Editable?) {

            override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {

            override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {



If your app is published in the play store and not found in search here are the details of the issue.

Follow us on Google News