0

I want to add textChangedListener() on TextInputEditText. But can't find any of those listeners.

Like editext.addTextChangedListener( new TextWatcher()...), is that method available for TextInputEditText? If no such listener is available then how to fetch string from TextInputEditText, while user is writing in it?

GrAnd
  • 10,141
  • 3
  • 31
  • 43

1 Answers1

0

First, find the TextInputEditText from its id.

TextInputEditTexteditText = findViewById(R.id.textInputEditText);

And then you can add addTextChangeListener in following way

 editText.addTextChangedListener(new TextWatcherAdapter(){
                    @Override
                    public void afterTextChanged(Editable editable) {
                        inputLayout.setPasswordVisibilityToggleEnabled(editable.length()>0);
                    }
        });

You can refer this link, Hope this will help.

Bhagwat K
  • 2,982
  • 2
  • 23
  • 33
  • i know how to use text change listener in case of EditText... I was trying to find textChangedListener for TextInputEditText... the above llistener is not working for TextInputEditText but it is working for EditText – shubham prakash Apr 02 '19 at 18:09
  • Hey, @shubhamprakash I have updated my answer please check now. – Bhagwat K Apr 02 '19 at 18:18