Я пишу следующее приложение:
- есть поле AutoCompleteTextView
- as Adapter Я использую ArrayAdapter с ListArray
- ListArray состоит из некоторого константного строкового элемента и одного элемента, который будет изменяться динамически каждый раз, когда пользователь вводит что-то в поле
Я взял TextChangedListener для обновления этого последнего элемента списка. Но похоже, что обновление происходит только один раз.
Я добавляю немного кода. Может быть, кто-нибудь может показать мне, что я сделал неправильно.
public class HelloListView extends Activity 
{
    List<String> countryList = null;    
    AutoCompleteTextView textView = null;   
    ArrayAdapter adapter = null;
    static String[] COUNTRIES = new String[] 
    {
          "Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra",
          "Yemen", "Yugoslavia", "Zambia", "Zimbabwe", ""
    };
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);        
        countryList = Arrays.asList(COUNTRIES);
        textView = (AutoCompleteTextView) findViewById(R.id.edit);
        adapter = new ArrayAdapter(this, android.R.layout.simple_dropdown_item_1line, countryList);
        adapter.notifyDataSetChanged();        
        textView.setAdapter(adapter);
        textView.setThreshold(1);
        textView.addTextChangedListener(new TextWatcher() 
        {
            public void onTextChanged(CharSequence s, int start, int before, int count) 
            {               
                countryList.set(countryList.size()-1, "User input:" + textView.getText());                
            }
            public void beforeTextChanged(CharSequence s, int start, int count,
                    int after) 
            {               
            }
            public void afterTextChanged(Editable s) 
            {
            }
        });
        new Thread() 
        {
            public void run() 
            {
                // Do a bunch of slow network stuff.
                update();
            }
        }.start();        
    }
    private void update() 
    {
        runOnUiThread(new Runnable() 
        {
            public void run() 
            {
                adapter.notifyDataSetChanged();
            }
        });
    }
}
