It's the following, I'm not able to find out if the user typed something in EditorText
. What I want is that, every character, number or letter that the user types, I can do an action right after.
I researched a lot, I did several tests but I could not because I was new to android. From what I understand, there are 2 functions that MAYBE I can use:
Using the setOnEditorActionListener :
private EditText valor;
protected void onCreate(Bundle savedInstanceState) {
valor = findViewById(R.id.valor);
valor.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
if(digitou algo){
System.out.println("DIGITOU!");
}
return false;
}
});
}
Using the setOnKeyListener :
valor.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View view, int i, KeyEvent keyEvent) {
if(digitou algo){
System.out.println("DIGITOU!");
}
return false;
}
});
Is it possible to do this?