views:

793

answers:

2

If you own Android phone you are no doubt have noticed how in the certain apps the keyboard layout can change from the standard issue to digits-only or to have .com or .net special buttons based on the text field input type (e.g. phone number). So I have 2 questions:

  1. how to trigger this customization? I suspect it has to do with EditText format
  2. Can this be taken even further if I want to add some custom buttons to inject a specific pattern? Say I would have an AND button which when pressed will add all uppercase " AND " surrounded by spaces to the text field. Can this be done?
  3. What I'm not asking is how to capture some key combination in onKeyPress event and then populate text field with a pattern - I pretty much know how to do that already.
+3  A: 
fiXedd
Very nice, thank you. Do you know if it's possible to fake ALT key on the virtual keyboard somehow? Can I designate say HOME button as ALT?
DroidIn.net
No problem... it was something I'd been meaning to play with anyhow :) I don't think you can simulate the alt key, but again, I could be wrong. It should be noted that it's possible to implement your own keyboard (more or less) from scratch. They have an example: http://developer.android.com/guide/samples/SoftKeyboard/index.html
fiXedd
Understand. Though implementing full custom keyboard is perhaps a little bit too much for my humble app :)
DroidIn.net
+1  A: 

The thing that concerns me is that "inputType" is listed as a deprecated property, meaning it may work for a while, but - eventually - Android will stop supporting it. Is there another alternative?

UPDATED: My bad - I'm confusing with inputMethod.

Chas