Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid - AutoCompleteTextView, showDropDown() doesn't always work
    text
    copied!<p>When I'm trying to update the autoCompleteTextview ArrayAdapter dynamiclly each time, if the dropdown is shown this disappear and showDropDown() has no effect.</p> <p>My code:</p> <pre><code> @Override protected void onCreate(Bundle savedInstanceState) { ................................................. mAutoComepleteTextView = (AutoCompleteTextView)findViewById(R.id.tv_autocomplete_search); mAutoComepleteTextView.setOnItemClickListener(this); mAutoComepleteTextView.addTextChangedListener(this); mArrayAdaptor = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_dropdown_item_1line); mArrayAdaptor.setNotifyOnChange(false); mAutoComepleteTextView.setAdapter(mArrayAdaptor); mAutoComepleteTextView.setOnFocusChangeListener(this); mAutoComepleteTextView.setOnClickListener(this); ................................................. } </code></pre> <p>OnClick event:</p> <pre><code> @Override public void onClick(View v) { super.onClick(v); switch(v.getId()){ case R.id.tv_autocomplete_search: mAutoComepleteTextView.showDropDown(); // here work fine break; default : break; } } </code></pre> <p>onFocusChange event:</p> <pre><code> @Override public void onFocusChange(View v, boolean hasFocus) { switch(v.getId()){ case R.id.tv_autocomplete_search: mAutoComepleteTextView.showDropDown(); // here work fine break; default : break; } } </code></pre> <p>My callback, here is my problem:</p> <pre><code> @Override public void onNewFriends(Vector&lt;Friend&gt; friends) { super.onNewFriends(friends); runOnUiThread(new Runnable() { @Override public void run() { boolean isVisible = mAutoComepleteTextView.isPopupShowing(); if(isVisible) mAutoComepleteTextView.dismissDropDown(); mArrayAdaptor.clear(); for (Friend friend : ActivitiesPrefsData.getInstace().getFriends()) { if (friend.m_strEmail.equals(D.username)){ mArrayAdaptor.add(friend.m_deviceInfo.m_strName); } else mArrayAdaptor.add(friend.m_strEmail); } mArrayAdaptor.notifyDataSetChanged(); if(isVisible) mAutoComepleteTextView.showDropDown(); // here doesn't work } }); } </code></pre> <p>I would be grateful for any help, thanks.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload