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)