Get information about AutocompleteTextView from resulting AutoCompleteTextView$DropDownListView

后端 未结 1 1128
别那么骄傲
别那么骄傲 2021-01-05 17:03

I\'m using 3 AutocompleteTextViews to suggest entries from a database. I subclassed AutocompleteTextView to handle setting the default text to null when clicked and setting

相关标签:
1条回答
  • 2021-01-05 17:31

    Instead of using this as the listener, create a new listener class and give it your autocomplete textview:

    public class MyActivity extends Activity {
    
       // .... somewhere
       from_auto_complete.setOnItemClickListener(new MyClickListener(from_auto_complete));
    
       private class MyClickListener implements OnClickListener {
           AutoCompleteTextView autoComplete;
           MyClickListener(AutoCompleteTextView actv) {
               autoComplete = actv;
           }
           // ... handle clicks
       }
    }
    
    0 讨论(0)
提交回复
热议问题