how to get letter entered instantly in android?

EditText et = (EditText) findViewById(R.id.EditText01);

        et.addTextChangedListener( new TextWatcher()
        {
            @Override
            public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) {

                try
                {
                    char currentChar = arg0.charAt(arg1); // currently typed character
                }
                catch(Exception e)
                {
                    // error
                }
            }

            @Override
            public void beforeTextChanged(CharSequence arg0, int arg1, int arg2,
                    int arg3) {

            }

            @Override
            public void afterTextChanged(Editable arg0) {

            }
        });

You can use the method TextView.addTextChangedListener(TextWatcher watcher)

TextWatcher provides 3 nice methods :

public abstract void afterTextChanged (Editable s)

public abstract void beforeTextChanged (CharSequence s, int start, int count, int after)

public abstract void onTextChanged (CharSequence s, int start, int before, int count)

Here the doc

Tags:

Android