Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Automatically move to next edittext in android

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 6.38k
    Comment on it

    Hi,

    In android, we have TextWatcher interface to keep track of input that we are typing.
    Usually it is very useful when we need verification on the basic of text length and content also.

    It has method onTextChanged(CharSequence s, int start, int before, int count) by which we can catch event as we change text.

    Below is the implementation.

    EditText mExpirationYear,mCvvNumber;
    
    mExpirationYear.addTextChangedListener(new TextWatcher() {
    
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                // TODO Auto-generated method stub
                if (mExpirationYear.getText().toString().trim().length() == 2)     //size as per your requirement
                {
                    mCvvNumber.requestFocus();
                }
            }
    
            public void beforeTextChanged(CharSequence s, int start,
                                          int count, int after) {
                // TODO Auto-generated method stub
    
            }
    
            public void afterTextChanged(Editable s) {
                // TODO Auto-generated method stub
            }
    
        });
    

 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: