How to pop-up the "?123" Android keyboard - android

I have an EditText which needs to process either numerical and/or alphabetical input depending on state. The user may enter either type of input in some circumstances. I've only been able to pop-up the "Phone" keyboard using setInputType (InputType.TYPE_CLASS_NUMBER); which works, but doesn't allow the user a way to get back to the QWERTY keyboard. Since most of the input is indeed numerical, I would like to present the user with the ?123 keyboard most of the time. They would only need to go back to the QWERTY keyboard a few times.
How can I pop-up the onscreen QWERTY keyboard for alphabetical input, and then pop-up the "?123" keyboard if it's numerical? I just want to save a step for the user so they don't have to hit the ?123 button on the QWERTY keyboard every time.
Update: This is the keyboard I would like visible. The reason is I would like the user to easily switch between Alphabetical input and Numerical input. There is no way to switch to the QWERTY keyboard from the "number pad". In my app, numerical input is required for 90% of the input so I would like to pop it up as a convenience. In other words, rather than having to switch to the numerical keyboard 90% of the time, they only need to switch to QWERTY 10% of the time
The call to input.setRawInputType(Configuration.KEYBOARD_QWERTY); works differently on Honeycomb and later versions of Gingerbread (brings up the number pad). On Gingerbread 2.2.3 it works the way I want. Honeycomb and 2.3.7 keyboard screengrabs are below for reference. I don't know why they are so different.

You can use several ways to use number keyboard.
Some are listed below,
Method 1:
add this attribute to your text field(EditText)
android:inputType="number"
Method 2:
use it programmatically
edittext.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED);

I believe this post answers your question.
In short add this to your code:
editText.setRawInputType(Configuration.KEYBOARD_QWERTY);

Related

Soft keyboard for numbers that allows entering letters

Is there an InputType for (default) Android soft keyboards that is targeted at entering numbers but also allows entering letters?
This would be for an input fields like the house number, that most of the time contains only numbers, but sometimes also letters.
On iOS, there is UIKeyboardTypeNumbersAndPunctuation that displays the normal keyboard, but with the page that contains the numbers; you can then switch back to the letter page.
There is no such things in Android.
You should take a lokk at the official documentation : InputType
InputType TYPE_TEXT_VARIATION_POSTAL_ADDRESS seems closest to what you need.
if you want to start with a numeric keyboard initially and then want to switch to qwerty this answer might help you.

how to avoid the number row appearing from android keyboard?

In my project , I use an editext for entering names and I require only a keyboard without number rows on the top. I would like to avoid the appearance of the number
row on top line of the keyboard. How to do it?
The decision as to whether or not to show a row of numbers on a soft keyboard is up to the implementer of the soft keyboard, not you. Some soft keyboards will always have it. Some will never have it.
The android:inputType attribute is where you provide a hint of what you want, that some soft keyboards may elect to honor. However, there is no inputType option for "all possible characters except numeric digits" or even "only letters". And, more generally, there is no option for you to say "well, I want the user to be able to enter digits, but please do not put those digits on the main keyboard, but instead have the user switch to some alternate layout to get those digits".

How can I read out and set the "shift state" of the soft keyboard on Android?

I have an EditText view, and the app user can type in any text (e.g. username or password). The user might switch to the "numeric shift state" on the soft keyboard, e.g. when only entering number digits. When the user next enters the activity I'd like to restore the "numeric shift state" of the soft keyboard, so that he doesn't always have to switch to the keyboard state he last used.
So I need to "read out" somehow what state of the input method is currently active when I leave the activity (or the focus of the field). I also have to initialize the input method of the field when opening the soft keyboard. Is there a way to do it on android?
Note: I don't want to force input method by setting inputMethod to "number".
No such API. No such concepts even- the idea of a "shift state" may exist in an individual keyboard, but its not part of the Android framework and may or may not exist within a given keyboard.
In fact some keyboard could use meta-states, by doing this 'shift' work by sending keycode_shift to android system. But it's not an forced behavior so we can't detect what's real current status is.

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