@Override public void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Object selectedItem = autoCompleteAdapter.getItem(position); if (selectedItem != null) { // Well that a little bit too direct it should be more a listener // But not sure how fragments will behaves on restore for now Activity superAct = getActivity(); if (superAct instanceof SipHome) { Fragment frag = ((SipHome) superAct).getCurrentFragment(); if (frag != null && frag instanceof DialerFragment) { ((DialerFragment) frag) .setTextFieldValue( autoCompleteAdapter.getFilter().convertResultToString(selectedItem)); } } } }
/** * Filter the query to some filter string * * @param constraint the string to filter on */ public void filter(CharSequence constraint) { autoCompleteAdapter.setSelectedText(constraint.toString()); this.constraint = constraint; }