I want to get a text from the material design's TextInputLayout using a custom end Icon.
I tried to do that:
TextInputLayout textInputCustomEndIcon = findViewById(R.id.editText);
final TextInputEditText editText = new TextInputEditText(textInputCustomEndIcon.getContext());
    
textInputCustomEndIcon.setEndIconOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        if (editText.getText() != null) {
            String text = editText.getText().toString();
    
            Log.i("MainActivity", "setEndIconOnClickListener:"+ text);
        }
    }
});
But I get an empty text, not null but empty!!
 
     
     
     
     
     
     
    