Skip to content Skip to sidebar Skip to footer

Enter Data In EditText And Respond Without Pressing Enter

I have an editText with a listener. edittext.setOnKeyListener(new OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { // If the event is a

Solution 1:

I think you want to implement functionality like whenever user enter any character you want to check , if this is the case then there is a TextWatcher class for you. In which you can override its 3 methods: afterTextChanged, beforeTextChanged and onTextChanged.

mPasswordLength = (EditText)findViewById(R.id.password_length);
mPasswordLength.addTextChangedListener(new TextWatcher() {
    public void afterTextChanged(Editable s) {
    }
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    }
});

Post a Comment for "Enter Data In EditText And Respond Without Pressing Enter"