powder366
powder366

Reputation: 4441

Add colon to InputType.TYPE_CLASS_NUMBER keyboard

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', '.', ':', '-', ',' };
        }
    };
    mytext.setKeyListener(keyListener);

But I also like the colon(:) on the number keyboard?

Upvotes: 5

Views: 1115

Answers (1)

Todd Sjolander
Todd Sjolander

Reputation: 1569

In order to change the characters on a soft keyboard, you need to create a custom IME.

Android doc

Upvotes: 1

Related Questions