According to the question and answer posted How to automatically move to the next edit text in android , I used the code to move to the next edit box.
et1.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start,int before, int count)
{
// TODO Auto-generated method stub
if(et1.getText().toString().length()==size) //size as per your requirement
{
et2.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
}
});
The issue I am facing is in case I enter something wrong, then even if the user explicitly request focus , the text box moves to the next one due to the code in the text watcher. Is there anything I can do to prevent this from happening ?