Add a colon to the keyboard InputType.TYPE_CLASS_NUMBER

How to add a colon (:) to a soft keyboard with an input type I InputType.TYPE_CLASS_NUMBER currently 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?

+5
source share
1 answer

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

Android doc

+1
source

All Articles