wufoo
wufoo

Reputation: 14571

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

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 enter image description here

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.

Honeycomb 3.2 keyboard for Configuration.KEYBOARD_QWERTY Gingerbread 2.3.7 keyboard for Configuration.KEYBOARD_QWERTY

Upvotes: 10

Views: 8655

Answers (2)

Dev.Barai
Dev.Barai

Reputation: 92

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);

Upvotes: 1

HD_Mouse
HD_Mouse

Reputation: 577

I believe this post answers your question.

In short add this to your code:

editText.setRawInputType(Configuration.KEYBOARD_QWERTY);

Upvotes: 0

Related Questions