void
void

Reputation: 479

show English keyboard for EditText(Android)

In my android application I used EditText to take text input from user. I want that EditText only accept selective characters, for that in xml file I mentioned following property for EditText.

android:digits="@string/customDigits"

and customDigits is mentioned in strings.xml

<string name="customDigits">\u0022;\u005C;&amp;&lt;&gt;&#92; abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!#$%\'()*+,-./:;=?@[]_`{};|~^"*"</string>

I gave multilanguage support for my android applicaton. When I choose languages like FRENCH,GERMAN,SPANISH and EditText is in focus then it shows proper English keyboard as shown :-

enter image description here

But when I select JAPANESE language and EditText is in focus then it shows Japanes keyboard as shown :-

enter image description here

But I want to show English keyboard by default. Kindly provide me solution.

Upvotes: 3

Views: 3467

Answers (2)

qtri_nguyen
qtri_nguyen

Reputation: 1

It may be too late, I'm facing the same issue as you.

I came up with solution imeOptions="flagForceAscii and the keyboard displaying Roman alphabet characters as first priority.

Hope it can help in somehow. forceAscii

Upvotes: 0

Marcin Orlowski
Marcin Orlowski

Reputation: 75645

You can try

input.setRawInputType(Configuration.KEYBOARD_QWERTY);

But from UX perspective I'd say there's nothing you should be "fixing" here. If user decides he wants Japanese, he gets Japanese. You expect certain characters but it's nothing to do with user language settings nor what type of keyboard he uses. It's none of your interest really - just reject his input if it is failing and ensure that error message (or UI) clearly indicates you expect ASCII (or whatever) to be entered in that EditText.

Upvotes: 0

Related Questions