androidandroid-layoutandroid-edittextandroid-input-method

Continuous OTP input with EditText


Here is 4 EditText for input a numeric password. I want it to be like, If first EditText is filled by 1 number then, focus should goes to next EditText and should also work same in reverse manner. So that user can keep entering password from Left most and can also erase same way from Right most.

Can someone suggest what can be the best approach to proceed?

Currently looks like this


Solution

  • You can use the library Android PinView / OtpView

    or you can use addTextChangedListener to add a TextWatcher which is called whenever this EditTextView's text changes then you can call View.requestFocus() on the next EditText to focus it