I am using EditText's
to accept an OTP, where user has focus on next EditText
once he enters a digit to a field and so. It works fine on all devices. But on devices running android OS P i.e. API 28, requestFocus()
does not work, and user is not able to enter digits to consecutive EditTexts
as focus doesn't move automatically.
Here is the code - by default all EditText's
are disable to prevent from opening system keyboard. I am using my own CustomKeybaord
to accept numbers. However it works except Android P.
mEtCode1.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
Log.d("BEFORE_", charSequence.toString());
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
hideError(charSequence.toString());
if (!charSequence.toString().isEmpty()) {
mEtCode2.requestFocus();
mEtCode1.setBackground(getResources().getDrawable(R.drawable.verify_code_edit_text_background));
mEtCode2.setBackground(getResources().getDrawable(R.drawable.verify_code_edit_text_background));
mEtCode1.setEnabled(false);
}
}
@Override
public void afterTextChanged(Editable editable) {
}
});
Please help me with this
Thank you, in advance