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 7004111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:09:25+00:00 2026-05-27T21:09:25+00:00

Does anybody knows why the android:nextFocusDown attibute stops working when we set the onClick

  • 0

Does anybody knows why the android:nextFocusDown attibute stops working when we set the onClick on it?

On the example below, we have some EditText with this attribute defined:

<TableRow
android:weightSum="1"
android:gravity="center">
<EditText
    android:id="@+id/txtChave1"
    android:maxLength="4"
    android:gravity="center"
    android:textSize="16dp"
    android:layout_height="wrap_content"
    android:layout_weight=".23"
    android:layout_width="0dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:singleLine="true"
    android:selectAllOnFocus="true"
    android:inputType="textCapCharacters"
    android:nextFocusDown="@+id/txtChave2"></EditText>

<EditText
    android:id="@+id/txtChave2"
    android:maxLength="4"
    android:gravity="center"
    android:textSize="16dp"
    android:layout_height="wrap_content"
    android:layout_weight=".23"
    android:layout_width="0dp"
    android:layout_marginRight="5dp"
    android:singleLine="true"
    android:selectAllOnFocus="true"
    android:inputType="textCapCharacters"
    android:nextFocusDown="@+id/txtChave3"></EditText>

<EditText
    android:id="@+id/txtChave3"
    android:maxLength="4"
    android:gravity="center"
    android:textSize="16dp"
    android:layout_height="wrap_content"
    android:layout_weight=".23"
    android:layout_width="0dp"
    android:layout_marginRight="5dp"
    android:singleLine="true"
    android:selectAllOnFocus="true"
    android:inputType="textCapCharacters"
    android:nextFocusDown="@+id/txtChave4"></EditText>

<EditText
    android:id="@+id/txtChave4"
    android:maxLength="4"
    android:gravity="center"
    android:textSize="16dp"
    android:layout_height="wrap_content"
    android:layout_weight=".23"
    android:layout_width="0dp"
    android:layout_marginRight="5dp"
    android:singleLine="true"
    android:selectAllOnFocus="true"
    android:inputType="textCapCharacters"></EditText>
</TableRow>

As defined above, when user clicks on the “next button” on virtual keyboard, the focus changes as expected… But, if we set the onClick attribute, the android:nextFocusDown doen´t work anymore.

<EditText
android:id="@+id/txtChave1"
android:maxLength="4"
android:gravity="center"
android:textSize="16dp"
android:layout_height="wrap_content"
android:layout_weight=".23"
android:layout_width="0dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:singleLine="true"
android:selectAllOnFocus="true"
android:inputType="textCapCharacters"
android:nextFocusDown="@+id/txtChave2"
android:onClick="onClickHandler">
</EditText>

Any advice?

Thanks a lot!

  • 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-27T21:09:26+00:00Added an answer on May 27, 2026 at 9:09 pm

    Do it programmatically because when you call android:nextFocusDown in XML may be the object that you want to call in the nextFocus will not create it till.

    private void setUpView(){
        editText1=(EditText)findViewById(R.id.editText1);
        editText2=(EditText)findViewById(R.id.editText2);
        editText3=(EditText)findViewById(R.id.editText3);
    }
    
    private void setUpFocus(){
        editText1.setNextFocusDownId(R.id.editText2);
        editText2.setNextFocusDownId(R.id.editText8);// you can give focus to any id
        editText3.setNextFocusDownId(R.id.editText9);
    }
    

    Call setUpView() before setUpFocus() in onCreate().

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

Sidebar

Related Questions

I have to analyse some existing Erlang code. Does anybody knows about a tool
Does anybody know the working of android.intent.action.SYNC ? How would one go about testing
Does anybody knows how can I set margins to a custom dialog? I'm asking
Does anybody knows the unit of the return value of Sensor.TYPE_LIGHT on Android ?
Does anybody knows why this snippet returns false even if the passed string is
Does anybody knows how can I get the max and min value of the
Does anybody knows which charset is used in Moldava. We to prepare our software
Does anybody knows a good wrapper implementation for Google Search Appliance?
Does anybody knows about post-processing algorithms to remove ghost objects from binarized image? The
Does anybody knows when there will be more updated information than the following info

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.