Closed pittgikera closed 6 years ago
any update on this?
add an additional if for checking the next or previous focus available or not in afterTextChanged like this
@Override public void afterTextChanged(Editable s) { if (mCurrentlyFocusedEditText.focusSearch(FOCUS_RIGHT) != null || mCurrentlyFocusedEditText.focusSearch(FOCUS_LEFT) != null) { if (mCurrentlyFocusedEditText.getText().length() >= 1 && mCurrentlyFocusedEditText != mOtpFourField) { mCurrentlyFocusedEditText.focusSearch(View.FOCUS_RIGHT).requestFocus(); } else if (mCurrentlyFocusedEditText.getText().length() >= 1 && mCurrentlyFocusedEditText == mOtpFourField) { InputMethodManager imm = (InputMethodManager) getContext().getSystemService( Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(getWindowToken(), 0); } } else { String currentValue = mCurrentlyFocusedEditText.getText().toString(); if (currentValue.length() <= 0 && mCurrentlyFocusedEditText.getSelectionStart() <= 0) { mCurrentlyFocusedEditText.focusSearch(View.FOCUS_LEFT).requestFocus(); } } } }
The issue is with you setting number as a string please convert the value to a string data type and check
Calling setOTP on the otpView produces an exception.