11

I'm having an EditText where I set the inputType="textEmailAddress". My understanding is that this should bring up a soft keyboard that's more suitable for email address entry.

In the blog entry for IMF Android IMF there is a particular image shown for composiong email where the soft keyboard consists of '@' key for email address entry.

But in this particular answer the displayed soft keyboard shows a '.com' key besides the '@' key.

Is this '.com' key a default key with android:inputType="textEmailAddress"? Or is there some setting involved?

Community
  • 1
  • 1
yjw
  • 3,394
  • 4
  • 20
  • 20

3 Answers3

22

There is no "default" really. android:inputType is merely a hint for your IME. Now that IME could be the stock Android 1.1 keyboard, the Android 2.0 keyboard, the HTC Sense keyboard, SwiftKey, Swype, you name it. Each one can decide for itself whether or not to add a ".com" key (or to entirely ignore inputType).

EboMike
  • 76,846
  • 14
  • 164
  • 167
  • Thanks. Was wondering why the .com key is not popping up in my emulator (tried across Google API 3,8,10 but only '@' is common for all 3). I really thought '.com' is a logical key for inputType="textEmailAddress" and I'm lacking something somewhere when it's not appearing in my tests – yjw Mar 26 '11 at 06:22
6

Try this, it might help you

editText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS);
Jithu
  • 1,478
  • 1
  • 13
  • 21
  • Normally +1 is recommended for "worked for me", and this did work for me, but perhaps a little more will be helpful in this case. I have an app which has email field, with 'InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS'. which worked on most test phones, but not one. In this phone, neither @ nor .COM were on the soft keyboard. This change added the @ key, in the usual place (there's no room for '.com'). Simple, non-obvious, and a big improvement! – Stephen Hosking Jul 21 '16 at 00:25
1

Android's own SDK has an example of using inputType to modify behaviour (see: http://developer.android.com/resources/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.html)

Interestingly, KeyEvent does not have a specific key code for the '.com' key in the question. I assume it uses an unused key code for this purpose.

  • Thanks. Will look through it for reference. Was just wondering how this .com key actually pops up in the reference answer in my question. I thought it's logical for this key to be part of the soft keyboard for inputType="textEmailAddress" but for some reason I'm not getting it in my emulator – yjw Mar 26 '11 at 06:20
  • 1
    KeyEvent is for low-level inputs. `.com` is a high level button in the IME and works on a level where auto-complete and other IME features operate. – EboMike Mar 26 '11 at 06:25