Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Methods to monitor android EditText

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 301
    Comment on it

    If you have to perform certain tasks before, after and during the text changes in android EditText the following methods will help you to monitor your operations. Implementing the Textwatcher interface provides the callback methods listed below, these basic methods will also determine the number of characters inserted. 

    public void beforeTextChanged(CharSequence s, int start, int count, int after);
    public void onTextChanged(CharSequence s, int start, int before, int count);
    public void afterTextChanged(Editable s);

    Example:-

    etTextChange.addTextChangedListener(new TextWatcher() {
                @Override
                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    
                }
    
                @Override
                public void onTextChanged(CharSequence s, int start, int before, int count) {
                    textCount = etTextChange.getText().length();
                    setTitle(String.valueOf(textCount));
    		Log.e(TAG, String.valueOf(textCount))
                }
    
                @Override
                public void afterTextChanged(Editable s) {
    
                }
    });

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: