Saturday, September 8, 2012

Re: [android-developers] Add colon to InputType.TYPE_CLASS_NUMBER

You cannot force input method editors (IMEs) to have any particular
keys. You can *request* general *classes* (e.g., numeric), and the IME
*may* elect to honor that request. However, there isn't even a way to
request a particular key, let alone any way to ensure that it will be
there.

Either use a class that is likely to have the desired key on it
already (e.g., TYPE_CLASS_TEXT), or have your own button for adding in
such characters in your own UI (e.g., a colon Button adjacent to the
EditText).

On Sat, Sep 8, 2012 at 9:01 AM, powder366 <jonas.heyman@gmail.com> wrote:
> How can I add colon(:) to the soft keyboard with the input type
> InputType.TYPE_CLASS_NUMBER Currently I have the following code:
>
> NumberKeyListener keyListener = new NumberKeyListener() {
> public int getInputType() {
> return InputType.TYPE_CLASS_NUMBER;
> }
>
> @Override
> protected char[] getAcceptedChars() {
> return new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8',
> '9', '.', ':', '-', ',' };
> }
> };
>
> But I also like the colon(:) on the number keyboard?

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 4.1 Available!

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate