Change associated EditText with keyboard

Viewed 9

I have four edit text with input type number on the same screen, now problem is that when I switch from one EditText to the other the default selection of keyboard resets to 1, and it's reflecting that the new keyboard is shown. Is there any way I can use the previous keyboard and switch my focus to another EditText?

User should not feel that a new keyboard is shown?

inner class OtpTextWatcherImpl constructor(private val e: EditText) : EmptyTextWatcher() {
    override fun afterTextChanged(otp: Editable) {
        if (value.length == mOtpLength) {
            mListener?.onDataEntered(this@OTPView, true)
        }
        moveToEditText(e.id, otp.isEmpty())
    }
}

fun moveToEditText(n: Int, deleteOp: Boolean) {
    if (deleteOp && n > 0) {
        Handler(Looper.getMainLooper()).postDelayed({
            editTextList[n - 1].requestFocus()
        }, 500)
    } else if (n < otpLength - 1 && !deleteOp) {
        editTextList[n + 1].requestFocus()
    }
}
0 Answers
Related