Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8541637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:52:34+00:00 2026-06-11T11:52:34+00:00

I need to let the user enter times in format hh:mm , but because

  • 0

I need to let the user enter times in format hh:mm, but because of the issue 28132 I can’t use

<EditText ... android:inputType="time">

I thought I’d accept any separator, e.g., something like hh mm or hh.mm, but such characters can’t be typed either (logical as they don’t belong in time; colon does but is missing from the keyboard). Changing the type to text would work, but the text keyboard is not as good for typing.

So I thought about removing the colon just before the edit starts and putting it back when it ends, but I don’t know how to recognize these events. addTextChangedListener allows to track all fine grained changes, but I don’t think it makes sense to change the text during the time it gets edited, I’d rather need events like editStarts and editEnds, corresponding with showing and hiding the keyboard. Are they such events?

What workaround for this bug would you recommend?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:52:35+00:00Added an answer on June 11, 2026 at 11:52 am

    You should use an InputFilter for your TextView and validate whether the input is of type Time.

    Since TimeKeyListener also implements a InputFilter.

    You could probably use

     TextView.setInputFilter({new TimeKeyListener()});
    

    EDIT:
    Or you could even custom time key listener with . as a accepted character

        edittext.setKeyListener(new TimeKeyListener() {
            public final char[] CHARS = new char[] {
                    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'm', 'p', ':', '.'
            };
    
            @Override
            protected char[] getAcceptedChars() {
                return CHARS;
            }
        });
    

    Now it’s also easy to replace the alternate separator (dot) by colon like follows:

    public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
        final CharSequence superSource = super.filter(source, start, end, dest, dstart, dend);
        final CharSequence prefilteredSource = superSource!=null ? superSource : source;
        return prefilteredSource.toString().replace('.', ':');
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am suppose to let the user enter a DateTime format, but I need
Let's assume a user enter address of some resource and we need to translate
I need to let the user enter their password in the user/register process. I've
I have a simple application in which I need to let the user select
I have a C# project using windows forms. I need to let the user
I need to let users select an item from a dropdown list, but also
I've created FormView let user enter the data to save into database. And i
I let user enter some code in my Flex3 (Flash 10) app and I
for example, we have a web form to let the user enter personal info
I need a solution where a user could enter the URL of a web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.