Disable Android AutoCompleteTextView after user selects item from drop down





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







14















I'm using Android's AutoCompleteTextView with a CursorAdapter to add autocomplete to an app. In the view's onItemClickListener() (i.e. when the user touches one of the autocompleted drop down items) I retrieve the text and place it in the EditText so that the user can modify it if they need to.



However, when I call setText() on the TextView the autocomplete behavior is triggered and the dropdown shows again. I'd like to only show the dropdown if the user types new text with the keyboard. Is there a way to do this?










share|improve this question























  • I am doing something similiar HERE!!! stackoverflow.com/questions/12854336/…

    – toobsco42
    Oct 30 '12 at 19:45


















14















I'm using Android's AutoCompleteTextView with a CursorAdapter to add autocomplete to an app. In the view's onItemClickListener() (i.e. when the user touches one of the autocompleted drop down items) I retrieve the text and place it in the EditText so that the user can modify it if they need to.



However, when I call setText() on the TextView the autocomplete behavior is triggered and the dropdown shows again. I'd like to only show the dropdown if the user types new text with the keyboard. Is there a way to do this?










share|improve this question























  • I am doing something similiar HERE!!! stackoverflow.com/questions/12854336/…

    – toobsco42
    Oct 30 '12 at 19:45














14












14








14


4






I'm using Android's AutoCompleteTextView with a CursorAdapter to add autocomplete to an app. In the view's onItemClickListener() (i.e. when the user touches one of the autocompleted drop down items) I retrieve the text and place it in the EditText so that the user can modify it if they need to.



However, when I call setText() on the TextView the autocomplete behavior is triggered and the dropdown shows again. I'd like to only show the dropdown if the user types new text with the keyboard. Is there a way to do this?










share|improve this question














I'm using Android's AutoCompleteTextView with a CursorAdapter to add autocomplete to an app. In the view's onItemClickListener() (i.e. when the user touches one of the autocompleted drop down items) I retrieve the text and place it in the EditText so that the user can modify it if they need to.



However, when I call setText() on the TextView the autocomplete behavior is triggered and the dropdown shows again. I'd like to only show the dropdown if the user types new text with the keyboard. Is there a way to do this?







android user-interface autocomplete






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 8 '11 at 15:03









magneticMonstermagneticMonster

1,02142142




1,02142142













  • I am doing something similiar HERE!!! stackoverflow.com/questions/12854336/…

    – toobsco42
    Oct 30 '12 at 19:45



















  • I am doing something similiar HERE!!! stackoverflow.com/questions/12854336/…

    – toobsco42
    Oct 30 '12 at 19:45

















I am doing something similiar HERE!!! stackoverflow.com/questions/12854336/…

– toobsco42
Oct 30 '12 at 19:45





I am doing something similiar HERE!!! stackoverflow.com/questions/12854336/…

– toobsco42
Oct 30 '12 at 19:45












5 Answers
5






active

oldest

votes


















15














You can use the dismissDropDown() method of the AutoCompleteTextView object. Take a look at the documentation.






share|improve this answer
























  • I want to prevent the drop down from showing until new keys are typed. If I use dismissDropDown() the dropdown will briefly show before getting dismissed.

    – magneticMonster
    Nov 8 '11 at 15:21











  • If you put the method call in the onItemClickListener() it should dismiss the list, when you click on one item. Isn't this what you want?

    – Franziskus Karsunke
    Nov 8 '11 at 15:28






  • 1





    Didn't work for me, just reappears.

    – Vucko
    May 21 '18 at 10:43



















6














If you wish to dissmis AutoCompleteTextView's dropdown you should use its post(Runnable r) method. It works for me :)



Here is an example:



mAutoCompleteTextView.post(new Runnable() {
public void run() {
mAutoCompleteTextView.dismissDropDown();
}
}





share|improve this answer
























  • I also added the same snippet in onConfigurationChanged in my activity

    – Svetoslav Marinov
    Apr 14 '14 at 7:30











  • This didn't work for me, the dropdown just appeared again.

    – Vucko
    May 21 '18 at 10:40











  • @Vucko Please check my answer. This trick wasn't working for me also.

    – CopsOnRoad
    Jul 3 '18 at 10:00



















2














Answering my own question after a couple hours of hacking at this: It turns out you should implement your own OnItemClickListener and instead rely on the existing click listener to populate the TextView. I had originally implemented the onItemClickListener because it was using the results of Cursor.toString() to populate the text view. To change the output String, you should implement convertToString(Cursor) in your CursorAdapter. The CharSequence that gets returned will be populated in the text view.



Doing this will also prevent the dropdown from showing up again (since setText() triggers the completion behavior but the default onItemClickListener does not).






share|improve this answer































    1














    When we click on item suggested in AutoCompleteTextView.onTextChanged() is performed before onItemClick
    So, to avoid this try below code..



    autocompletetextview.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
    if (autocompletetextview.isPerformingCompletion()) {
    // An item has been selected from the list. Ignore.
    } else {
    // Perform your task here... Like calling web service, Reading data from SQLite database, etc...
    }
    }

    @Override
    public void afterTextChanged(final Editable editable) {

    }
    });





    share|improve this answer





















    • 1





      YES! this is exactly what I needed. You were right that my app made an API call after a user selected an item in the list, which then re-populated the list and showed it ! That's now fixed, thanks!

      – Someone Somewhere
      Oct 23 '18 at 14:07






    • 1





      Thanks, autocompletetextview.isPerformingCompletion() just saved me.

      – Florescu Cătălin
      Dec 12 '18 at 8:50













    • @FlorescuCătălin Welcome:)

      – Ketan Ramani
      Dec 12 '18 at 9:19



















    0














    Different approach.
    I agreed dismissDropDown() works but in my case, it wasn't working as expected. So, I used:



    autoCompleteTextView.setDropDownHeight(0);


    And if you want to show the dropdown list again, you an use



    autoCompleteTextView.setDropDownHeight(intValue);





    share|improve this answer
























    • Yeah I tried this also but how do I know intValue? It's different with each search mate :)

      – Vucko
      Jul 4 '18 at 12:45











    • In my case, I was using a hard coded value. This is like a max value and if you have less items for a particular choice, the height will reduce to make up with your new choices. So, there is like no disadvantage of using a hard coded value.

      – CopsOnRoad
      Jul 6 '18 at 9:07












    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f8052483%2fdisable-android-autocompletetextview-after-user-selects-item-from-drop-down%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    15














    You can use the dismissDropDown() method of the AutoCompleteTextView object. Take a look at the documentation.






    share|improve this answer
























    • I want to prevent the drop down from showing until new keys are typed. If I use dismissDropDown() the dropdown will briefly show before getting dismissed.

      – magneticMonster
      Nov 8 '11 at 15:21











    • If you put the method call in the onItemClickListener() it should dismiss the list, when you click on one item. Isn't this what you want?

      – Franziskus Karsunke
      Nov 8 '11 at 15:28






    • 1





      Didn't work for me, just reappears.

      – Vucko
      May 21 '18 at 10:43
















    15














    You can use the dismissDropDown() method of the AutoCompleteTextView object. Take a look at the documentation.






    share|improve this answer
























    • I want to prevent the drop down from showing until new keys are typed. If I use dismissDropDown() the dropdown will briefly show before getting dismissed.

      – magneticMonster
      Nov 8 '11 at 15:21











    • If you put the method call in the onItemClickListener() it should dismiss the list, when you click on one item. Isn't this what you want?

      – Franziskus Karsunke
      Nov 8 '11 at 15:28






    • 1





      Didn't work for me, just reappears.

      – Vucko
      May 21 '18 at 10:43














    15












    15








    15







    You can use the dismissDropDown() method of the AutoCompleteTextView object. Take a look at the documentation.






    share|improve this answer













    You can use the dismissDropDown() method of the AutoCompleteTextView object. Take a look at the documentation.







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 8 '11 at 15:08









    Franziskus KarsunkeFranziskus Karsunke

    3,68012745




    3,68012745













    • I want to prevent the drop down from showing until new keys are typed. If I use dismissDropDown() the dropdown will briefly show before getting dismissed.

      – magneticMonster
      Nov 8 '11 at 15:21











    • If you put the method call in the onItemClickListener() it should dismiss the list, when you click on one item. Isn't this what you want?

      – Franziskus Karsunke
      Nov 8 '11 at 15:28






    • 1





      Didn't work for me, just reappears.

      – Vucko
      May 21 '18 at 10:43



















    • I want to prevent the drop down from showing until new keys are typed. If I use dismissDropDown() the dropdown will briefly show before getting dismissed.

      – magneticMonster
      Nov 8 '11 at 15:21











    • If you put the method call in the onItemClickListener() it should dismiss the list, when you click on one item. Isn't this what you want?

      – Franziskus Karsunke
      Nov 8 '11 at 15:28






    • 1





      Didn't work for me, just reappears.

      – Vucko
      May 21 '18 at 10:43

















    I want to prevent the drop down from showing until new keys are typed. If I use dismissDropDown() the dropdown will briefly show before getting dismissed.

    – magneticMonster
    Nov 8 '11 at 15:21





    I want to prevent the drop down from showing until new keys are typed. If I use dismissDropDown() the dropdown will briefly show before getting dismissed.

    – magneticMonster
    Nov 8 '11 at 15:21













    If you put the method call in the onItemClickListener() it should dismiss the list, when you click on one item. Isn't this what you want?

    – Franziskus Karsunke
    Nov 8 '11 at 15:28





    If you put the method call in the onItemClickListener() it should dismiss the list, when you click on one item. Isn't this what you want?

    – Franziskus Karsunke
    Nov 8 '11 at 15:28




    1




    1





    Didn't work for me, just reappears.

    – Vucko
    May 21 '18 at 10:43





    Didn't work for me, just reappears.

    – Vucko
    May 21 '18 at 10:43













    6














    If you wish to dissmis AutoCompleteTextView's dropdown you should use its post(Runnable r) method. It works for me :)



    Here is an example:



    mAutoCompleteTextView.post(new Runnable() {
    public void run() {
    mAutoCompleteTextView.dismissDropDown();
    }
    }





    share|improve this answer
























    • I also added the same snippet in onConfigurationChanged in my activity

      – Svetoslav Marinov
      Apr 14 '14 at 7:30











    • This didn't work for me, the dropdown just appeared again.

      – Vucko
      May 21 '18 at 10:40











    • @Vucko Please check my answer. This trick wasn't working for me also.

      – CopsOnRoad
      Jul 3 '18 at 10:00
















    6














    If you wish to dissmis AutoCompleteTextView's dropdown you should use its post(Runnable r) method. It works for me :)



    Here is an example:



    mAutoCompleteTextView.post(new Runnable() {
    public void run() {
    mAutoCompleteTextView.dismissDropDown();
    }
    }





    share|improve this answer
























    • I also added the same snippet in onConfigurationChanged in my activity

      – Svetoslav Marinov
      Apr 14 '14 at 7:30











    • This didn't work for me, the dropdown just appeared again.

      – Vucko
      May 21 '18 at 10:40











    • @Vucko Please check my answer. This trick wasn't working for me also.

      – CopsOnRoad
      Jul 3 '18 at 10:00














    6












    6








    6







    If you wish to dissmis AutoCompleteTextView's dropdown you should use its post(Runnable r) method. It works for me :)



    Here is an example:



    mAutoCompleteTextView.post(new Runnable() {
    public void run() {
    mAutoCompleteTextView.dismissDropDown();
    }
    }





    share|improve this answer













    If you wish to dissmis AutoCompleteTextView's dropdown you should use its post(Runnable r) method. It works for me :)



    Here is an example:



    mAutoCompleteTextView.post(new Runnable() {
    public void run() {
    mAutoCompleteTextView.dismissDropDown();
    }
    }






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Oct 15 '12 at 7:49









    ToochkaToochka

    5521624




    5521624













    • I also added the same snippet in onConfigurationChanged in my activity

      – Svetoslav Marinov
      Apr 14 '14 at 7:30











    • This didn't work for me, the dropdown just appeared again.

      – Vucko
      May 21 '18 at 10:40











    • @Vucko Please check my answer. This trick wasn't working for me also.

      – CopsOnRoad
      Jul 3 '18 at 10:00



















    • I also added the same snippet in onConfigurationChanged in my activity

      – Svetoslav Marinov
      Apr 14 '14 at 7:30











    • This didn't work for me, the dropdown just appeared again.

      – Vucko
      May 21 '18 at 10:40











    • @Vucko Please check my answer. This trick wasn't working for me also.

      – CopsOnRoad
      Jul 3 '18 at 10:00

















    I also added the same snippet in onConfigurationChanged in my activity

    – Svetoslav Marinov
    Apr 14 '14 at 7:30





    I also added the same snippet in onConfigurationChanged in my activity

    – Svetoslav Marinov
    Apr 14 '14 at 7:30













    This didn't work for me, the dropdown just appeared again.

    – Vucko
    May 21 '18 at 10:40





    This didn't work for me, the dropdown just appeared again.

    – Vucko
    May 21 '18 at 10:40













    @Vucko Please check my answer. This trick wasn't working for me also.

    – CopsOnRoad
    Jul 3 '18 at 10:00





    @Vucko Please check my answer. This trick wasn't working for me also.

    – CopsOnRoad
    Jul 3 '18 at 10:00











    2














    Answering my own question after a couple hours of hacking at this: It turns out you should implement your own OnItemClickListener and instead rely on the existing click listener to populate the TextView. I had originally implemented the onItemClickListener because it was using the results of Cursor.toString() to populate the text view. To change the output String, you should implement convertToString(Cursor) in your CursorAdapter. The CharSequence that gets returned will be populated in the text view.



    Doing this will also prevent the dropdown from showing up again (since setText() triggers the completion behavior but the default onItemClickListener does not).






    share|improve this answer




























      2














      Answering my own question after a couple hours of hacking at this: It turns out you should implement your own OnItemClickListener and instead rely on the existing click listener to populate the TextView. I had originally implemented the onItemClickListener because it was using the results of Cursor.toString() to populate the text view. To change the output String, you should implement convertToString(Cursor) in your CursorAdapter. The CharSequence that gets returned will be populated in the text view.



      Doing this will also prevent the dropdown from showing up again (since setText() triggers the completion behavior but the default onItemClickListener does not).






      share|improve this answer


























        2












        2








        2







        Answering my own question after a couple hours of hacking at this: It turns out you should implement your own OnItemClickListener and instead rely on the existing click listener to populate the TextView. I had originally implemented the onItemClickListener because it was using the results of Cursor.toString() to populate the text view. To change the output String, you should implement convertToString(Cursor) in your CursorAdapter. The CharSequence that gets returned will be populated in the text view.



        Doing this will also prevent the dropdown from showing up again (since setText() triggers the completion behavior but the default onItemClickListener does not).






        share|improve this answer













        Answering my own question after a couple hours of hacking at this: It turns out you should implement your own OnItemClickListener and instead rely on the existing click listener to populate the TextView. I had originally implemented the onItemClickListener because it was using the results of Cursor.toString() to populate the text view. To change the output String, you should implement convertToString(Cursor) in your CursorAdapter. The CharSequence that gets returned will be populated in the text view.



        Doing this will also prevent the dropdown from showing up again (since setText() triggers the completion behavior but the default onItemClickListener does not).







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 8 '11 at 15:37









        magneticMonstermagneticMonster

        1,02142142




        1,02142142























            1














            When we click on item suggested in AutoCompleteTextView.onTextChanged() is performed before onItemClick
            So, to avoid this try below code..



            autocompletetextview.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            if (autocompletetextview.isPerformingCompletion()) {
            // An item has been selected from the list. Ignore.
            } else {
            // Perform your task here... Like calling web service, Reading data from SQLite database, etc...
            }
            }

            @Override
            public void afterTextChanged(final Editable editable) {

            }
            });





            share|improve this answer





















            • 1





              YES! this is exactly what I needed. You were right that my app made an API call after a user selected an item in the list, which then re-populated the list and showed it ! That's now fixed, thanks!

              – Someone Somewhere
              Oct 23 '18 at 14:07






            • 1





              Thanks, autocompletetextview.isPerformingCompletion() just saved me.

              – Florescu Cătălin
              Dec 12 '18 at 8:50













            • @FlorescuCătălin Welcome:)

              – Ketan Ramani
              Dec 12 '18 at 9:19
















            1














            When we click on item suggested in AutoCompleteTextView.onTextChanged() is performed before onItemClick
            So, to avoid this try below code..



            autocompletetextview.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            if (autocompletetextview.isPerformingCompletion()) {
            // An item has been selected from the list. Ignore.
            } else {
            // Perform your task here... Like calling web service, Reading data from SQLite database, etc...
            }
            }

            @Override
            public void afterTextChanged(final Editable editable) {

            }
            });





            share|improve this answer





















            • 1





              YES! this is exactly what I needed. You were right that my app made an API call after a user selected an item in the list, which then re-populated the list and showed it ! That's now fixed, thanks!

              – Someone Somewhere
              Oct 23 '18 at 14:07






            • 1





              Thanks, autocompletetextview.isPerformingCompletion() just saved me.

              – Florescu Cătălin
              Dec 12 '18 at 8:50













            • @FlorescuCătălin Welcome:)

              – Ketan Ramani
              Dec 12 '18 at 9:19














            1












            1








            1







            When we click on item suggested in AutoCompleteTextView.onTextChanged() is performed before onItemClick
            So, to avoid this try below code..



            autocompletetextview.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            if (autocompletetextview.isPerformingCompletion()) {
            // An item has been selected from the list. Ignore.
            } else {
            // Perform your task here... Like calling web service, Reading data from SQLite database, etc...
            }
            }

            @Override
            public void afterTextChanged(final Editable editable) {

            }
            });





            share|improve this answer















            When we click on item suggested in AutoCompleteTextView.onTextChanged() is performed before onItemClick
            So, to avoid this try below code..



            autocompletetextview.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            if (autocompletetextview.isPerformingCompletion()) {
            // An item has been selected from the list. Ignore.
            } else {
            // Perform your task here... Like calling web service, Reading data from SQLite database, etc...
            }
            }

            @Override
            public void afterTextChanged(final Editable editable) {

            }
            });






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 22 '18 at 6:36

























            answered Aug 17 '18 at 5:55









            Ketan RamaniKetan Ramani

            884812




            884812








            • 1





              YES! this is exactly what I needed. You were right that my app made an API call after a user selected an item in the list, which then re-populated the list and showed it ! That's now fixed, thanks!

              – Someone Somewhere
              Oct 23 '18 at 14:07






            • 1





              Thanks, autocompletetextview.isPerformingCompletion() just saved me.

              – Florescu Cătălin
              Dec 12 '18 at 8:50













            • @FlorescuCătălin Welcome:)

              – Ketan Ramani
              Dec 12 '18 at 9:19














            • 1





              YES! this is exactly what I needed. You were right that my app made an API call after a user selected an item in the list, which then re-populated the list and showed it ! That's now fixed, thanks!

              – Someone Somewhere
              Oct 23 '18 at 14:07






            • 1





              Thanks, autocompletetextview.isPerformingCompletion() just saved me.

              – Florescu Cătălin
              Dec 12 '18 at 8:50













            • @FlorescuCătălin Welcome:)

              – Ketan Ramani
              Dec 12 '18 at 9:19








            1




            1





            YES! this is exactly what I needed. You were right that my app made an API call after a user selected an item in the list, which then re-populated the list and showed it ! That's now fixed, thanks!

            – Someone Somewhere
            Oct 23 '18 at 14:07





            YES! this is exactly what I needed. You were right that my app made an API call after a user selected an item in the list, which then re-populated the list and showed it ! That's now fixed, thanks!

            – Someone Somewhere
            Oct 23 '18 at 14:07




            1




            1





            Thanks, autocompletetextview.isPerformingCompletion() just saved me.

            – Florescu Cătălin
            Dec 12 '18 at 8:50







            Thanks, autocompletetextview.isPerformingCompletion() just saved me.

            – Florescu Cătălin
            Dec 12 '18 at 8:50















            @FlorescuCătălin Welcome:)

            – Ketan Ramani
            Dec 12 '18 at 9:19





            @FlorescuCătălin Welcome:)

            – Ketan Ramani
            Dec 12 '18 at 9:19











            0














            Different approach.
            I agreed dismissDropDown() works but in my case, it wasn't working as expected. So, I used:



            autoCompleteTextView.setDropDownHeight(0);


            And if you want to show the dropdown list again, you an use



            autoCompleteTextView.setDropDownHeight(intValue);





            share|improve this answer
























            • Yeah I tried this also but how do I know intValue? It's different with each search mate :)

              – Vucko
              Jul 4 '18 at 12:45











            • In my case, I was using a hard coded value. This is like a max value and if you have less items for a particular choice, the height will reduce to make up with your new choices. So, there is like no disadvantage of using a hard coded value.

              – CopsOnRoad
              Jul 6 '18 at 9:07
















            0














            Different approach.
            I agreed dismissDropDown() works but in my case, it wasn't working as expected. So, I used:



            autoCompleteTextView.setDropDownHeight(0);


            And if you want to show the dropdown list again, you an use



            autoCompleteTextView.setDropDownHeight(intValue);





            share|improve this answer
























            • Yeah I tried this also but how do I know intValue? It's different with each search mate :)

              – Vucko
              Jul 4 '18 at 12:45











            • In my case, I was using a hard coded value. This is like a max value and if you have less items for a particular choice, the height will reduce to make up with your new choices. So, there is like no disadvantage of using a hard coded value.

              – CopsOnRoad
              Jul 6 '18 at 9:07














            0












            0








            0







            Different approach.
            I agreed dismissDropDown() works but in my case, it wasn't working as expected. So, I used:



            autoCompleteTextView.setDropDownHeight(0);


            And if you want to show the dropdown list again, you an use



            autoCompleteTextView.setDropDownHeight(intValue);





            share|improve this answer













            Different approach.
            I agreed dismissDropDown() works but in my case, it wasn't working as expected. So, I used:



            autoCompleteTextView.setDropDownHeight(0);


            And if you want to show the dropdown list again, you an use



            autoCompleteTextView.setDropDownHeight(intValue);






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jul 3 '18 at 9:59









            CopsOnRoadCopsOnRoad

            6,77222329




            6,77222329













            • Yeah I tried this also but how do I know intValue? It's different with each search mate :)

              – Vucko
              Jul 4 '18 at 12:45











            • In my case, I was using a hard coded value. This is like a max value and if you have less items for a particular choice, the height will reduce to make up with your new choices. So, there is like no disadvantage of using a hard coded value.

              – CopsOnRoad
              Jul 6 '18 at 9:07



















            • Yeah I tried this also but how do I know intValue? It's different with each search mate :)

              – Vucko
              Jul 4 '18 at 12:45











            • In my case, I was using a hard coded value. This is like a max value and if you have less items for a particular choice, the height will reduce to make up with your new choices. So, there is like no disadvantage of using a hard coded value.

              – CopsOnRoad
              Jul 6 '18 at 9:07

















            Yeah I tried this also but how do I know intValue? It's different with each search mate :)

            – Vucko
            Jul 4 '18 at 12:45





            Yeah I tried this also but how do I know intValue? It's different with each search mate :)

            – Vucko
            Jul 4 '18 at 12:45













            In my case, I was using a hard coded value. This is like a max value and if you have less items for a particular choice, the height will reduce to make up with your new choices. So, there is like no disadvantage of using a hard coded value.

            – CopsOnRoad
            Jul 6 '18 at 9:07





            In my case, I was using a hard coded value. This is like a max value and if you have less items for a particular choice, the height will reduce to make up with your new choices. So, there is like no disadvantage of using a hard coded value.

            – CopsOnRoad
            Jul 6 '18 at 9:07


















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f8052483%2fdisable-android-autocompletetextview-after-user-selects-item-from-drop-down%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Guess what letter conforming each word

            Port of Spain

            Run scheduled task as local user group (not BUILTIN)