SearchView setSearchableInfo - 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 setSearchableInfo method.

This code example shows how to use the following methods:getRootView, setIconifiedByDefault, setSearchableInfo
		searchField.addTextChangedListener(this);
 
		SearchView searchView = (SearchView) this
				.findViewById(SEARCHVIEW_FIELD_ID);
		// Assumes current activity is the searchable activity 
		searchView.setSearchableInfo(searchManager
				.getSearchableInfo(getComponentName()));
		searchView.setIconifiedByDefault(false);
		// Do not iconify the widget; 
		// expand it by default 
		searchView.getRootView().requestFocus();
 
		Intent intent = getIntent();
		if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
			String query = intent.getStringExtra(SearchManager.QUERY);
			doSearch(query);
		} 
	} 
 
	@Override 
5
CodeRank
This code example shows how to use the following methods:setSearchableInfo
 
    private void setUpSearch() { 
        // Get the SearchView and set the searchable configuration 
        SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
        // Assumes current activity is the searchable activity 
        searchView.setSearchableInfo(searchManager.getSearchableInfo(
                new ComponentName(this, SearchableActivity.class)
        )); 
    } 
 
    private void doSearch() { 
        Intent intent = new Intent(this, SearchableActivity.class);
        intent.setAction(Intent.ACTION_SEARCH);
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
        intent.putExtra(SearchManager.QUERY, searchView.getQuery().toString());
        startActivity(intent);
    } 
     
} 
4
CodeRank

Related SearchView setSearchableInfo Questions & Answers:

Other SearchView setSearchableInfo Examples

7:			SearchView searchView = (SearchView) menu.findItem(R.id.action_search)
8:					.getActionView();
9:			searchView.setSearchableInfo(searchManager
10:					.getSearchableInfo(getComponentName()));
11:

Read More

setSearchableInfo Method Overview
Sets the SearchableInfo for this SearchView.
See Code Examples for other Android SearchView Methods: