Code example for AutoCompleteTextView

Methods: getWindowToken

    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
        // Hide the keyboard since the user explicitly selected an item. 
        InputMethodManager manager =
                (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
        manager.hideSoftInputFromWindow(mAutoCompleteTextView.getWindowToken(), 0);
        // An onClickListener for the view item because I haven't figured out a 
        // way to update the AutoCompleteTextView without causing an infinite loop. 
        mHideFilterSearchOnStart = true;
    public void onClick(View v) {
        if (mAutoCompleteTextView != null && !mAutoCompleteTextView.isPopupShowing()) {
    // 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