SearchView setOnSuggestionListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for SearchView setOnSuggestionListener method.

This code example shows how to use the following methods:setOnSuggestionListener, setSuggestionsAdapter
        int[] to = { android.R.id.text1 };
        mSuggestAdapter =
                new SimpleCursorAdapter(mParent.getActivity(),
                                        android.R.layout.simple_list_item_activated_1,
                                        mSuggestCursor, from, to, 0);
        mSearchView.setSuggestionsAdapter(mSuggestAdapter);
        mSearchView.setOnSuggestionListener(new OnSuggestionListener() {
            @Override 
            public boolean onSuggestionClick (int position) {
                submitQuery("", position);
                return true; 
            } 
 
            @Override 
            public boolean onSuggestionSelect (int position) {
                submitQuery("", position);
                return true; 
            } 
        }); 
    } 
4
CodeRank
This code example shows how to use the following methods:setOnQueryTextListener, setOnSuggestionListener
 
  @Override 
  public void configureSearchWidget(Activity activity, final MenuItem menuItem) {
    super.configureSearchWidget(activity, menuItem);
    SearchView searchView = (SearchView) menuItem.getActionView();
    searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
      @Override 
      public boolean onQueryTextSubmit(String query) {
        menuItem.collapseActionView();
        return false; 
      } 
      @Override 
      public boolean onQueryTextChange(String newText) {
        return false; 
      } 
    }); 
    searchView.setOnSuggestionListener(new SearchView.OnSuggestionListener() {
        @Override 
      public boolean onSuggestionSelect(int position) {
        return false; 

4
CodeRank

Related SearchView setOnSuggestionListener Questions & Answers:

setOnSuggestionListener Method Overview
Sets a listener to inform when a suggestion is focused or clicked.
See Code Examples for other Android SearchView Methods: