Code example for AutoCompleteTextView

Methods: getAdapterisPopupShowingsetAdaptergetText

0
        mFilterAdapter.onClick(view);
    } 
 
    @Override 
    public void onClick(View v) {
        if (mAutoCompleteTextView != null && !mAutoCompleteTextView.isPopupShowing()) {
            filterOnString(mAutoCompleteTextView.getText().toString());
        } 
    } 
 
    // This method will set the adapter if no adapter has been set.  The adapter is initialized 
    // here to prevent the drop-down from appearing uninvited on orientation change, as the 
    // AutoCompleteTextView.setText() will trigger the drop-down if the adapter has been set. 
    private void filterOnString(String string) {
        if (mAutoCompleteTextView.getAdapter() == null) {
            mAutoCompleteTextView.setAdapter(mFilterAdapter);
        } 
        mHideFilterSearchOnStart = false;
        mFilterAdapter.getFilter().filter(string);
    } 
} 
Experience pair programming with AI  Get Codota for Java