I need to insert a focus shift from one editText to another editText after a certain logic in my application. example: in a credit card number editText have a listener when the length of the value reaches 16 it skips to the expiration month editText ...
My code:
numberCard.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) {
if(s.length()==16){
// how to make it jump to another editText?
}
}
@Override
public void afterTextChanged(Editable s) {
}
});
If your second EditText is editText2
the you could do ediText2.requestFocus()