lock android keyboard to only show numerics - android

I have an android app that uses an EditText with android:inputType="number"
when the edittext first displays the softkeyboard appears with only numerics enabled (you can still see the other keys though.
The EditText also has android:digits="0123456789\n" as I want the users to be able to enter multiple lines
As soon as I hit the ENTER key to create another line the numeric keys disappear.
How can I...
a). Only show a numeric keyboard (with Enter key) e.g. just 0123456789?
b). Stop the softkeyboard showing all the other keys?

You want a multiline EditText and numeric keyboard? Seems possible, but deprecated. Check out this answer.
Update:
If everything fails, try to enforce the numeric type every time a line break is inserted:
editText.setInputType(InputType.TYPE_CLASS_NUMBER);

Found a solution
by employing
android:digits="0123456789\n"
android:inputType="phone|textMultiLine"
I obtain the desired effect.

Try this
editTextField.setRawInputType(Configuration.KEYBOARD_QWERTY);
This shows the normal key pad with the numeric version first, yet allows you to switch between them.
getInput.setRawInputType(Configuration.KEYBOARD_12KEY);

Related

Digit keyboard by default but allowing alphabetic characters

I have an EditText box and I want the default keyboard that comes up when it is selected to be the numeric keypad. However, I do want to allow users to enter alphabetic characters too. The solutions android:inputType="number" , et.setRawInputType(InputType.TYPE_CLASS_NUMBER)...etc does not work for me because restricts input to numeric digits only. Does someone know some solution??
Add the following line of code, and it will do the trick :)
editText.setRawInputType(Configuration.KEYBOARD_QWERTY);
This will show the the numeric keypad first, but also allows you to enter free text.
More information tap here
This problem is similar to the this.

android get number only keyboard

I'm creating a app in flash cs 6. I want to know if it is possible to get numbers only soft keyboard and is it possible to replace enter key to done key and when done key is pressed I want the virtual keyboard gets down.
Put this on the edit text for which you want to open the number only key board
android:inputType="number"
Also add android:singleLine="true" for the EditText. This will replace the enter with Next (for all edittexts except the last one) and Done (for the last one).

How to remove calculator buttons from numeric keypad

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.

Start Different Keyboard for different activities

My application has two requirements where one screen is an numeric entry and other has an search option. Since user has to use the numeric keyboard most of the time he has to change the input type of edit text and select the keyboard. Is there any way i could start a numeric keyboard for one activity and charater keyboard when other activty starts
Sebs
hiii,,,
Use for the edit text that should open a numeric keypad with following property:
android:inputType="phone"
And android:imeOptions="actionSearch" for other activity Edit Text xml layout
Hope you would be able to get what I mean to convey
With Regards,
Arpit Garg
To just get a numeric keyboard the user should not have to longpress and choose input type. That would be only if they are trying to change which actual keyboard application they are using, for instance switching from Android Keyboard to Swype keyboard. All of the different configurations of keys are all part of each keyboard separately. So the Android keyboard contains a qwerty keyboard, a number keyboard (which has numbers across the top row and symbols on all the other keys) and a Number pad keyboard (9x9 block of numbers like the numpad on your PC, or an old telephone). To tell the system which you'd like to use you just have to specify the inputType for your EditText.
this page will show you possible types
this question will show you how to set it from xml

Android Default to Numeric Keypad with Option for QWERTY

Is it possible to have Android's numeric keypad display for an EditText (the one that would show with inputType="number"), while still having an option for users to switch back to the normal QWERTY keyboard?
My input field will usually be a number, but there will be times when text is necessary so I'd like to make it very easy to enter numbers, and extremely simple to switch over to entering text.
Thanks!
Yes, you can programatically change the keyboard being used by using the setInputType() method. So for instance, you could add a button in your UI that changes the input type from just pure numbers to a full on QWERTY keyboard.
Try this. It should leave the button on the on-screen keyboard that lets you toggle between letters and numbers.
In xml, don't constrain the input--just leave it to the default of letters. (Not sure if this matters.)
mEditText.setRawInputType(InputType.TYPE_CLASS_NUMBER);

Categories

Resources