Currently, the issue is clicking on autosuggested text only filling the first textinput box, I want to fill all the six text inputs with the suggested code
Autosuggested Keyboard screen shot:
On clicking the autosuggested text, it is only filling first
Expected behaviour is to fill all the textinputs once user clicks on autosuggested code
This is a less explored use-case on StackOverflow, but, when you read Android docs for Auto-fill, in the OTP section, they have already provided generateSmsOtpHintForCharacterPosition which states and I quote:
When using multiple views where each view maps to a single digit of
the OTP, you can use the generateSmsOptHintForCharacterPosition()
method to generate per-character hints.
You can utilize the characterPosition parameter to auto-fill each EditText with the respective digit of the OTP auto-filled.
To do that, set
//Where Character Position (int) represents the digit position of the OTP for respective EditText, ranges from 1 to 8.
android:autofillHint="smsOTPCode{characterPosition}"
Related
I would love to add this elegant verification code screen to my app but I'm completely lost in how to do it
should I implement each box as a TextInputEditText ?
how can I make the cursor move from one box to the next one while typing ?
ps : I'm using kotlin
I would make those boxes as a TextViews (not EditText) - you don't want to have a soft keyboard opened and the user will be only using buttons below in order to enter verification code.
When the user presses number below - show it in the next available TextView, when every TextView is filled with number - verify whole code. The same should work backspace button - clearing previous filled TextView.
You might want to make TextView to be highlight when it is going to be filled with the next number press, you can do this with a state-list background.
I know there are several posts about facilitating navigation between EditText fields. However, I can't get the suggested solutions to work and still have my EditTexts automatically have the first letter be capitalized. While setting the input type to "text" accomplishes what I want, if I set it to "textCapSentences", even using imeOptions, nextFocus, etc., I can't get the behavior I'm looking for.
I'm building am app that will allow Odometer entry. I would like to use the image shown below as the background on an EditText. Doing that is no problem, however I can not seem to get the digits entered into the text view to line up in the spaces of the image. I've tried adjusted the text size, font face, etc.
Here is the image I would like to use...
Does anyone have any suggestions on how I can accomplish this? So that when the user entered digits into the EditText, each digit goes into the correct "slot"?
thank you!!!
You can use android:letterSpacing? (only applies api 21 and over)
Set up 6 separate EditTexts on top of that image each with dimensions of the square they need to go into. Then set up event handlers so that it appears to be one fluid motion across EditTexts when the user enters data. Not very elegant but it'll work.
The input type for my EditText control is set to "number." When the numeric keypad is displayed, besides showing the numbers, it also shows calculator keys (+/-/etc.). I am wondering if there is any setting to remove the calculator keys.
Thank you in advance for your help.
If all you need are actual numbers 0-9 you could set your keyboard type to "phone" instead of "number" which should give you a more 9-pad style keyboard that probably won't contain the extra keys like +, - etc...
However in the end it is up the currently running keyboard application (which is chosen by the user) If whatever keyboard they happen to be using shows keys that you would rather it not, there is generally no way for you to instruct it not to show those keys.
If you want to have complete control over the input then you'll have to create your own View that mimics the functionality of the keyboard and "manually" insert the typed characters into your EditText.
Add this line of code
input.setInputType(InputType.TYPE_CLASS_NUMBER);
Hope it helps.
I'm looking for a simple way for Android, when a user taps a in a edit text box, it will add a hyphen inbetween the number set. Sort of like a phone number, but will be set in a custom position.
For example Book number 05, CD number 15, track number5 = 0515-5. So when they start typing, the app will automatically enter the hyphen.
Should I use some type of listener and count how many characters are entered, then when it hits that number of characters, it will add the hyphen?
Thanks!
Use an InputFilter.
See my answers here: press "." many times (validate ip address in EditText while typing) and here: How to set Edittext view allow only two numeric values and two decimal values like ##.## for ideas on how to implement it