Open In App

How to Check Typing Status of EditText in Android?

Last Updated : 07 Mar, 2021
Like Article

In this article, we are going to implement an important and quite interesting feature. While Chatting with your friends over various social media platforms you may have found that if your friend is typing something then it shows Typing. Here are going to implement the same. While we start typing something, It will show typing, and when we erase everything it will show Stopped Typing. A sample GIF is given below to get an idea about what we are going to do in this article. Note that we are going to implement this project using the Java language. 

Check Typing Status of EditText in Android Sample GIF

Step by Step Implementation

Step 1: Create a New Project

To create a new project in Android Studio please refer to How to Create/Start a New Project in Android Studio. Note that select Java as the programming language.

Step 2: Working with the activity_main.xml file

Navigate to the app > res > layout > activity_main.xml and add the below code to that file. Below is the code for the activity_main.xml file. 


<?xml version="1.0" encoding="utf-8"?>
        android:hint="Type Something"
        android:textStyle="bold" />
        android:hint="Not typing"
        android:textStyle="bold" />

Step 3: Working with the file

Go to the file and refer to the following code. Below is the code for the file. Comments are added inside the code to understand the code in more detail.


import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
    EditText msg;
    TextView confirm;
    protected void onCreate(Bundle savedInstanceState) {
        msg = findViewById(;
        confirm = findViewById(;
        // When there is change in state of edittext input
        msg.addTextChangedListener(new TextWatcher() {
            // when there is no text added
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {
                if (s.toString().trim().length() == 0) {
                    // set text to Not typing
                    confirm.setText("Not Typing");
                } else {
                    // set text to typing
                    confirm.setText(" Typing");
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                confirm.setText(" Typing");
            // after we input some text
            public void afterTextChanged(Editable s) {
                if (s.toString().trim().length() == 0) {
                    // set text to Stopped typing
                    confirm.setText("Stopped Typing");


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads