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

  • Home
  • SEARCH
  • 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 7665003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T14:26:57+00:00 2026-05-31T14:26:57+00:00

I have 3 EditText elements, and I want to jump from one field to

  • 0

I have 3 EditText elements, and I want to jump from one field to the next if there are 4 characters in the input.

I use a TextWatcher for this:

getEditView(R.id.edit_code1).addTextChangedListener(new TextWatcher() {
    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {}

    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {}

    @Override
    public void afterTextChanged(Editable input) {
        if(input.length() == 4){
            getEditView(R.id.edit_code2).requestFocus();
        }
    }
});

The inputType for the EditText is “textCapCharacters”

When doing a longpress on a key to get a number, like holding R to get a 4, most devices will not add the letter, until the user stops holding the button, and will fire afterTextChanged after the letter 4 is selected. On a HTC keyboard (In this case the HTC Desire on 2.3.5) this is not the case. Even though the user is still holding the button, the R is added to the EditText and afterTextChanged is fired, and the code does its job and puts the focus on the next field.

How can this undesired behavior be prevented? Watching onKeyDown/Up won’t help, because it doesn’t register normal keystrokes.

  • 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-05-31T14:26:59+00:00Added an answer on May 31, 2026 at 2:26 pm

    Unfortunately it’s a bug in the HTC keyboard with no way of fixing it. This being an event in the IME, it is impossible intercept touch or key events, so you would probably be better off simply making the user skip to the next input instead of you doing it for them.

    If it’s that important for you though, you can implement your own kind of keyboard there, with only the keys you need.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have Four EditText with different background. It looks like this: I want to
I have an editText field for which I want check that it meets with
I have an Activity in Android, with two elements: EditText ListView When my Activity
I have an EditText and a Button set next to each other on the
I have an EditText which takes a String from the user and a searchButton.
I have an EditText for an email field. My mobile screen is really small
I have an edittext, and a textwatcher that watches if SPACE arrived or not.
I have a edittext in which some text are selected . I want to
My question is : I have an EditText and I want set a margin
To use as an example: lets say that I have 2 EditText s and

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.