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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 19, 20262026-06-19T02:58:24+00:00 2026-06-19T02:58:24+00:00

I have an XML layout with 20-25 similar rows which are used to set

  • 0

I have an XML layout with 20-25 similar rows which are used to set different parameters. The rows contain an AutoCompleteTextView and an ImageButton. Whenever an option is set within one of these views, a method is called to set the variable in my code, and then refresh all of the views. There are three ways each variable can be set…AutoCompleteTextView: OnKeyListener, OnItemSelectedListener….ImageButton: OnClickListener

Here is an example of this part of one of the rows:

pumpCountAutoText = new AutoCompleteTextView( this );
pumpCountAutoText.setHint( R.string.anti_pump_pump_count_hint );
pumpCountAutoText.setTextSize( 12.0f );
pumpCountAutoText.setLayoutParams( editLP );
pumpCountAutoText.setThreshold( 1 );
pumpCountAutoText.setId( 11001 );
pumpCountAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, pumpCountList);
pumpCountAutoText.setAdapter( pumpCountAdapter );
pumpCountAutoText.setOnKeyListener(new OnKeyListener() {
    public boolean onKey(View v, int keyCode, KeyEvent event) {
        // if keydown and "enter" is pressed
        if ((event.getAction() == KeyEvent.ACTION_DOWN)
            && (keyCode == KeyEvent.KEYCODE_ENTER)) {
                String item = pumpCountAutoText.getText().toString();
                hideSoftKeyboard( MoreParameters.this );
                pumpCountAutoText.dismissDropDown();
                if( hasRead ) {
                    if(pumpCountList.contains( item ) ) {
                         if( !( item.equals( " " ) ) ) {
                                int val = Integer.parseInt( item );
                                //Log.i( "pumpCountSpinner", Integer.toString( val ) );
                                RelayAPIModel.NativeCalls.SetParmJava( RelayAPIModel.PARM_PUMPCOUNT, val );
                            }
                        }
                    }
                    return true;
                }
                return false;
            }
         });
        pumpCountAutoText.setOnItemClickListener( new OnItemClickListener() {

            public void onItemClick(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                // TODO Auto-generated method stub
                hideSoftKeyboard( MoreParameters.this );
                String item = pumpCountAutoText.getText().toString();
                if( !( item.equals( " " ) ) ) {
                    int val = Integer.parseInt( item );
                    //Log.i( "pumpCountSpinner", Integer.toString( val ) );
                    RelayAPIModel.NativeCalls.SetParmJava( RelayAPIModel.PARM_PUMPCOUNT, val );
                }
            }

        });


        pumpCountDropdownButton = new ImageButton( this );
        pumpCountDropdownButton.setLayoutParams( dropLP );
        pumpCountDropdownButton.setId( 11002 );
        pumpCountDropdownButton.setImageResource( R.drawable.arrow_down_float );
        pumpCountDropdownButton.setOnClickListener( new OnClickListener() {

            public void onClick(View v) {
                // TODO Auto-generated method stub
                AlertDialog.Builder ab=new AlertDialog.Builder(MoreParameters.this);
                ab.setTitle( R.string.anti_pump_pump_count_hint );
                ab.setItems( pumpCountList.toArray( new String[pumpCountList.size()]), new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int pos ) {
                        String item = pumpCountList.get( pos );
                        if( !( item.equals( " " ) ) ) {
                            int val = Integer.parseInt( item );
                            RelayAPIModel.NativeCalls.SetParmJava( RelayAPIModel.PARM_PUMPCOUNT, val );
                        }
                    }
                });
                ab.show();
            }

        });

My problem is that after any of these items are set, the text field at the top of my screen automatically gets focused and displays the dropdown menu for that view. It is extremely annoying. I want to select an item in any view and not have these dropdowns appear.

I have tried two things:

1) I have added AutoCompleteTextView.setCursorVisible( false );

2) And I have also tried this:

specialCTAutoText.setFocusable( false );
specialCTAutoText.setFocusableInTouchMode( false );
specialCTAutoText.setText( temp );
specialCTAutoText.setFocusable( true );
specialCTAutoText.setFocusableInTouchMode( true );

The second thing I tried is called when all of my views are refreshed in the second method which is not shown here. This works fine. However, once I edit a textview one of those three ways, it still auto selects the top edittext view.

I hope this is clear enough, but any clarification needed let me know.

  • 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-19T02:58:26+00:00Added an answer on June 19, 2026 at 2:58 am

    However, once I edit a textview one of those three ways, it still auto selects the top edittext view.

    Try calling requestFocus() on some other widget at the point in time when you “edit a textview one of those three ways”.

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

Sidebar

Related Questions

I have a ListView with an ArrayAdapter which uses an XML layout, similar to
I have an XML layout similar to this (the XML and code is a
I have an xml layout which I use for each row in my listview:
I have two buttons in my xml layout as shown bellow. I used an
Ok so I have a layout xml similar to the following example: <?xml version=1.0
So I have a custom view set up in code (no XML layout defined
I have many different items on my main.xml layout (30+). I have to constantly
I have an xml file like below which I will use to set background
I have an XML layout that defines a TextView box 50px x 320px who
I have an XML layout and want to add my own custom SurfaceView to

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.