In chat App how to implement Typing indicator that someone is Typing just like whats-app or Messenger in Android Studio using Firebase

In chat App how to implement Typing indicator that someone is Typing just like whats-app or Messenger in Android Studio using Firebase

To achieve this, you need add a new field in your Firebase database named: typing with the default value of false. Then use addTextChangedListener() method on your EditText to actually see when someone types a message. When someone types something, onTextChanged() method is triggered. Now change the value of typing from false to true. After this, addValueEventListener to see when the value is changed. If the value is true, then display that message in your chat room. So, i suggest you using the following code:
yourEditText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!TextUtils.isEmpty(s)) {
//Set the value of typing field to true.
} else {
// Set to false
}
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {}
@Override
public void afterTextChanged(Editable s) {}
});