android.app.SearchManager Java Examples
The following examples show how to use
android.app.SearchManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SearchActivity.java From search-samples with Apache License 2.0 | 6 votes |
private void setupSearchView(MenuItem searchItem) { mSearchView.setIconifiedByDefault(false); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); if (searchManager != null) { List<SearchableInfo> searchables = searchManager.getSearchablesInGlobalSearch(); SearchableInfo info = searchManager.getSearchableInfo(getComponentName()); for (SearchableInfo inf : searchables) { if (inf.getSuggestAuthority() != null && inf.getSuggestAuthority().startsWith("applications")) { info = inf; } } mSearchView.setSearchableInfo(info); } mSearchView.setOnQueryTextListener(this); mSearchView.setFocusable(false); mSearchView.setFocusableInTouchMode(false); }
Example #2
Source File: SearchDB.java From moviedb-android with Apache License 2.0 | 6 votes |
public int getSuggestionSize() { SQLiteQueryBuilder queryBuilder = new SQLiteQueryBuilder(); queryBuilder.setProjectionMap(mAliasMap); queryBuilder.setTables(TABLE2_NAME); Cursor c = queryBuilder.query(mSearchDBOpenHelper.getReadableDatabase(), new String[]{"_ID", SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2, SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_INTENT_DATA_ID, SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA}, null, null, null, null, null, "10" ); return c.getCount(); }
Example #3
Source File: HpSearchBar.java From openlauncher with Apache License 2.0 | 6 votes |
@Override public void onInternetSearch(String string) { Intent intent = new Intent(); if (Tool.isIntentActionAvailable(_homeActivity.getApplicationContext(), Intent.ACTION_WEB_SEARCH) && !Setup.appSettings().getSearchBarForceBrowser()) { intent.setAction(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, string); } else { String baseUri = Setup.appSettings().getSearchBarBaseURI(); String searchUri = baseUri.contains("{query}") ? baseUri.replace("{query}", string) : (baseUri + string); intent.setAction(Intent.ACTION_VIEW); intent.setData(Uri.parse(searchUri)); } try { _homeActivity.startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
Example #4
Source File: NamesFragment.java From PretendYoureXyzzyAndroid with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.names_fragment, menu); if (getContext() == null) return; SearchManager searchManager = (SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE); MenuItem item = menu.findItem(R.id.namesFragment_search); item.setOnActionExpandListener(this); if (searchManager != null && getActivity() != null) { searchView = (SearchView) item.getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); searchView.setIconifiedByDefault(false); searchView.setOnCloseListener(this); searchView.setOnQueryTextListener(this); } }
Example #5
Source File: MainActivity.java From ActivityDiary with GNU General Public License v3.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_menu, menu); // Get the SearchView and set the searchable configuration SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); searchMenuItem = menu.findItem(R.id.action_filter); searchView = (SearchView) searchMenuItem.getActionView(); // Assumes current activity is the searchable activity searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setOnCloseListener(this); searchView.setOnQueryTextListener(this); // setOnSuggestionListener -> for selection of a suggestion // setSuggestionsAdapter searchView.setOnSearchClickListener(v -> setSearchMode(true)); return true; }
Example #6
Source File: VideoProvider.java From tv-samples with Apache License 2.0 | 6 votes |
@Override public String getType(@NonNull Uri uri) { switch (sUriMatcher.match(uri)) { // The application is querying the db for its own contents. case VIDEO_WITH_CATEGORY: return VideoContract.VideoEntry.CONTENT_TYPE; case VIDEO: return VideoContract.VideoEntry.CONTENT_TYPE; // The Android TV global search is querying our app for relevant content. case SEARCH_SUGGEST: return SearchManager.SUGGEST_MIME_TYPE; case REFRESH_SHORTCUT: return SearchManager.SHORTCUT_MIME_TYPE; // We aren't sure what is being asked of us. default: throw new UnsupportedOperationException("Unknown uri: " + uri); } }
Example #7
Source File: GamesFragment.java From PretendYoureXyzzyAndroid with GNU General Public License v3.0 | 6 votes |
@Override public void onCreateOptionsMenu(@NonNull Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.games_fragment, menu); if (getContext() == null) return; SearchManager searchManager = (SearchManager) getContext().getSystemService(Context.SEARCH_SERVICE); MenuItem item = menu.findItem(R.id.gamesFragment_search); item.setOnActionExpandListener(this); if (searchManager != null && getActivity() != null) { searchView = (SearchView) item.getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getActivity().getComponentName())); searchView.setIconifiedByDefault(false); searchView.setOnCloseListener(this); searchView.setOnQueryTextListener(this); } }
Example #8
Source File: EarthquakeSearchResultActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 6 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // If the search Activity exists, and another search // is performed, set the launch Intent to the newly // received search Intent. setIntent(intent); if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { // Update the selected search suggestion Id. setSelectedSearchSuggestion(getIntent().getData()); } else { // Extract the search query and update the searchQuery Live Data. String query = getIntent().getStringExtra(SearchManager.QUERY); setSearchQuery(query); } }
Example #9
Source File: SearchActivity.java From io2015-codelabs with Apache License 2.0 | 6 votes |
private void setupSearchView(MenuItem searchItem) { mSearchView.setIconifiedByDefault(false); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); if (searchManager != null) { List<SearchableInfo> searchables = searchManager.getSearchablesInGlobalSearch(); SearchableInfo info = searchManager.getSearchableInfo(getComponentName()); for (SearchableInfo inf : searchables) { if (inf.getSuggestAuthority() != null && inf.getSuggestAuthority().startsWith("applications")) { info = inf; } } mSearchView.setSearchableInfo(info); } mSearchView.setOnQueryTextListener(this); mSearchView.setFocusable(false); mSearchView.setFocusableInTouchMode(false); }
Example #10
Source File: CHMFrag.java From PowerFileExplorer with GNU General Public License v3.0 | 6 votes |
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); webview.findAllAsync(query); try { for (Method m : WebView.class.getDeclaredMethods()) { if (m.getName().equals("setFindIsUp")) { m.setAccessible(true); m.invoke((webview), true); break; } } } catch (Exception ignored) { } } else { currentPathTitle = intent.getDataString().substring("file://".length());//.getStringExtra("fileName"); Log.d(TAG, "chmFilePath " + currentPathTitle); Utils.chm = null; listSite = new ArrayList<>(); initView(); initFile(); } }
Example #11
Source File: CHMActivity.java From PowerFileExplorer with GNU General Public License v3.0 | 6 votes |
private void handleIntent(Intent intent) { if (Intent.ACTION_SEARCH.equals(intent.getAction())) { String query = intent.getStringExtra(SearchManager.QUERY); webview.findAllAsync(query); try { for (Method m : WebView.class.getDeclaredMethods()) { if (m.getName().equals("setFindIsUp")) { m.setAccessible(true); m.invoke((webview), true); break; } } } catch (Exception ignored) { } } else { chmFilePath = URLDecoder.decode(intent.getData().getPath());//.getStringExtra("fileName"); Log.d(TAG, "chmFilePath2 " + chmFilePath + ", intent " + intent); Utils.chm = null; listSite = new ArrayList<>(); initView(); initFile(); } }
Example #12
Source File: EarthquakeSearchResultActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 6 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // If the search Activity exists, and another search // is performed, set the launch Intent to the newly // received search Intent. setIntent(intent); if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { // Update the selected search suggestion Id. setSelectedSearchSuggestion(getIntent().getData()); } else { // Extract the search query and update the searchQuery Live Data. String query = getIntent().getStringExtra(SearchManager.QUERY); setSearchQuery(query); } }
Example #13
Source File: SearchActivity.java From good-weather with GNU General Public License v3.0 | 6 votes |
private void setupSearchView() { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); SearchView searchView = (SearchView) findViewById(R.id.search_view); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconified(false); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { mSearchCityAdapter.getFilter().filter(query); return true; } @Override public boolean onQueryTextChange(String newText) { mSearchCityAdapter.getFilter().filter(newText); return true; } }); }
Example #14
Source File: SearchActivity.java From Aria2App with GNU General Public License v3.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.search, menu); SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); MenuItem searchItem = menu.findItem(R.id.search_search); searchItem.setOnActionExpandListener(this); searchView = (SearchView) searchItem.getActionView(); if (searchManager != null) { searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); searchView.setIconifiedByDefault(false); searchView.setOnCloseListener(this); searchView.setOnQueryTextListener(this); } return true; }
Example #15
Source File: MainActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the options menu from XML MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.menu_main, menu); // Use the Search Manager to find the SearchableInfo related // to this Activity. SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchableInfo searchableInfo = searchManager.getSearchableInfo(getComponentName()); SearchView searchView = (SearchView) menu.findItem(R.id.search_view).getActionView(); searchView.setSearchableInfo(searchableInfo); searchView.setIconifiedByDefault(false); return true; }
Example #16
Source File: EarthquakeMainActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Inflate the options menu from XML MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options_menu, menu); // Use the Search Manager to find the SearchableInfo related // to the Search Result Activity. SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchableInfo searchableInfo = searchManager.getSearchableInfo( new ComponentName(getApplicationContext(), EarthquakeSearchResultActivity.class)); SearchView searchView = (SearchView)menu.findItem(R.id.search_view).getActionView(); searchView.setSearchableInfo(searchableInfo); searchView.setIconifiedByDefault(false); return true; }
Example #17
Source File: EarthquakeMainActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 6 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); // Inflate the options menu from XML MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.options_menu, menu); // Use the Search Manager to find the SearchableInfo related // to the Search Result Activity. SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchableInfo searchableInfo = searchManager.getSearchableInfo( new ComponentName(getApplicationContext(), EarthquakeSearchResultActivity.class)); SearchView searchView = (SearchView)menu.findItem(R.id.search_view).getActionView(); searchView.setSearchableInfo(searchableInfo); searchView.setIconifiedByDefault(false); return true; }
Example #18
Source File: TracksBrowser.java From mobile-manager-tool with MIT License | 6 votes |
public void onSearchWeb(){ String query = ""; if (Audio.Artists.CONTENT_TYPE.equals(mimeType)) { query = getArtist(); } else if (Audio.Albums.CONTENT_TYPE.equals(mimeType)) { query = getAlbum() + " " + getArtist(); } else if (Playlists.CONTENT_TYPE.equals(mimeType)) { query = bundle.getString(PLAYLIST_NAME); } else{ Long id = bundle.getLong(BaseColumns._ID); query = MusicUtils.parseGenreName(this, MusicUtils.getGenreName(this, id, true)); } final Intent googleSearch = new Intent(Intent.ACTION_WEB_SEARCH); googleSearch.putExtra(SearchManager.QUERY, query); startActivity(googleSearch); }
Example #19
Source File: EarthquakeSearchResultActivity.java From Wrox-ProfessionalAndroid-4E with Apache License 2.0 | 6 votes |
@Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); // If the search Activity exists, and another search // is performed, set the launch Intent to the newly // received search Intent. setIntent(intent); if (Intent.ACTION_VIEW.equals(getIntent().getAction())) { // Update the selected search suggestion Id. setSelectedSearchSuggestion(getIntent().getData()); } else { // Extract the search query and update the searchQuery Live Data. String query = getIntent().getStringExtra(SearchManager.QUERY); setSearchQuery(query); } }
Example #20
Source File: SearchResultActivity.java From easyweather with MIT License | 6 votes |
@Override public void initData() { ButterKnife.bind(this); Intent intent = getIntent(); query = intent.getStringExtra(SearchManager.QUERY); fm = getSupportFragmentManager(); SearchResultFragment fragment = (SearchResultFragment) fm.findFragmentById(R.id.fragment_container); if (fragment == null) { Bundle args = new Bundle(); args.putString("query",query); fragment = SearchResultFragment.newInstance(); fragment.setArguments(args); fm.beginTransaction().add(R.id.fragment_container,fragment).commit(); } mPresenter = new SearchResultPresenter(fragment); }
Example #21
Source File: ChromeActivity.java From delion with Apache License 2.0 | 6 votes |
protected IntentHandlerDelegate createIntentHandlerDelegate() { return new IntentHandlerDelegate() { @Override public void processWebSearchIntent(String query) { Intent searchIntent = new Intent(Intent.ACTION_WEB_SEARCH); searchIntent.putExtra(SearchManager.QUERY, query); startActivity(searchIntent); } @Override public void processUrlViewIntent(String url, String referer, String headers, TabOpenType tabOpenType, String externalAppId, int tabIdToBringToFront, boolean hasUserGesture, Intent intent) { } }; }
Example #22
Source File: MainActivity.java From Woodmin with Apache License 2.0 | 6 votes |
private void processIntent(Intent intent) { super.onNewIntent(intent); String action = intent.getAction(); if (action != null && (action.equals(Intent.ACTION_SEARCH) || action.equals(SearchIntents.ACTION_SEARCH))) { String query = intent.getStringExtra(SearchManager.QUERY); if(query != null && query.length()>0){ FragmentManager fragmentManager = getSupportFragmentManager(); if(query.toLowerCase().contains(getString(R.string.product_voice_search).toLowerCase())){ fragmentManager.beginTransaction() .replace(R.id.container, ProductsFragment.newInstance(2)) .commit(); } else if(query.toLowerCase().contains(getString(R.string.customer_voice_search).toLowerCase())){ fragmentManager.beginTransaction() .replace(R.id.container, CustomersFragment.newInstance(1)) .commit(); } else { fragmentManager.beginTransaction() .replace(R.id.container, OrdersFragment.newInstance(1)) .commit(); } } } }
Example #23
Source File: SearchManagerService.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private void updateSearchables() { final int changingUserId = getChangingUserId(); synchronized (mSearchables) { // Update list of searchable activities for (int i = 0; i < mSearchables.size(); i++) { if (changingUserId == mSearchables.keyAt(i)) { mSearchables.valueAt(i).updateSearchableList(); break; } } } // Inform all listeners that the list of searchables has been updated. Intent intent = new Intent(SearchManager.INTENT_ACTION_SEARCHABLES_CHANGED); intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT); mContext.sendBroadcastAsUser(intent, new UserHandle(changingUserId)); }
Example #24
Source File: BrowsingActivity.java From IslamicLibraryAndroid with GNU General Public License v3.0 | 5 votes |
protected void startSearch(String SearchQuery) { Intent searchIntent = new Intent(this, SearchResultActivity.class); searchIntent.setAction(Intent.ACTION_SEARCH); Bundle bundle = new Bundle(); bundle.putBoolean(ARG_IS_GLOBAL_SEARCH, true); ArrayList<Integer> selectedSearchableBooks = new ArrayList<>(); if (shouldDisplayDownloadedOnly()) { selectedSearchableBooks.addAll(selectedBooksIds); } else { HashSet<Integer> downloadedHashSet = mBooksInformationDbHelper.getBookIdsDownloadedOnly(); downloadedHashSet.retainAll(selectedBooksIds); if (downloadedHashSet.size() == 0) { Toast.makeText(this, R.string.no_downloaded_selected_books, Toast.LENGTH_SHORT).show(); return; } else { if (downloadedHashSet.size() < selectedBooksIds.size()) { Toast.makeText(this, R.string.searching_downloaded_only, Toast.LENGTH_SHORT).show(); } selectedSearchableBooks.addAll(downloadedHashSet); } } bundle.putIntegerArrayList(SearchResultFragment.ARG_SEARCHABLE_BOOKS, selectedSearchableBooks); bundle.putString(SearchManager.QUERY, SearchQuery); searchIntent.putExtras(bundle); startActivity(searchIntent); }
Example #25
Source File: SymbolSearchableActivity.java From ministocks with MIT License | 5 votes |
@Override public void onNewIntent(Intent intent) { if (Intent.ACTION_VIEW.equals(intent.getAction())) { // from click on search results Intent resultValue = new Intent(); resultValue.putExtra("symbol", intent.getDataString()); setResult(RESULT_OK, resultValue); finish(); } else if (Intent.ACTION_SEARCH.equals(intent.getAction())) { ListAdapter adapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, new String[]{String.format("Symbol \'%s\' is not found. Press to add it anyway.", intent.getStringExtra(SearchManager.QUERY))}); setListAdapter(adapter); } else if (Intent.ACTION_EDIT.equals(intent.getAction())) { startSearch(SearchManager.QUERY, false, null, false); } }
Example #26
Source File: BrowserProvider.java From coursera-android with MIT License | 5 votes |
public MySuggestionCursor(Cursor hc, Cursor sc, String string) { mHistoryCursor = hc; mSuggestCursor = sc; mHistoryCount = hc != null ? hc.getCount() : 0; mSuggestionCount = sc != null ? sc.getCount() : 0; if (mSuggestionCount > (mMaxSuggestionLongSize - mHistoryCount)) { mSuggestionCount = mMaxSuggestionLongSize - mHistoryCount; } mString = string; mIncludeWebSearch = string.length() > 0; // Some web suggest providers only give suggestions and have no description string for // items. The order of the result columns may be different as well. So retrieve the // column indices for the fields we need now and check before using below. if (mSuggestCursor == null) { mSuggestText1Id = -1; mSuggestText2Id = -1; mSuggestText2UrlId = -1; mSuggestQueryId = -1; mSuggestIntentExtraDataId = -1; } else { mSuggestText1Id = mSuggestCursor.getColumnIndex( SearchManager.SUGGEST_COLUMN_TEXT_1); mSuggestText2Id = mSuggestCursor.getColumnIndex( SearchManager.SUGGEST_COLUMN_TEXT_2); mSuggestText2UrlId = mSuggestCursor.getColumnIndex( SearchManager.SUGGEST_COLUMN_TEXT_2_URL); mSuggestQueryId = mSuggestCursor.getColumnIndex( SearchManager.SUGGEST_COLUMN_QUERY); mSuggestIntentExtraDataId = mSuggestCursor.getColumnIndex( SearchManager.SUGGEST_COLUMN_INTENT_EXTRA_DATA); } }
Example #27
Source File: MainActivity.java From moviedb-android with Apache License 2.0 | 5 votes |
/** * Initialize the contents of the Activity's standard options menu. * This is only called once, the first time the options menu is displayed. * * @param menu the options menu in which we place our items. * @return You must return true for the menu to be displayed; if you return false it will not be shown. */ @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); searchViewItem = menu.findItem(R.id.search); searchView = (SearchView) MenuItemCompat.getActionView(searchViewItem); searchView.setQueryHint(getResources().getString(R.string.search_hint)); searchView.setOnQueryTextListener(searchViewOnQueryTextListener); searchView.setOnSuggestionListener(searchSuggestionListener); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchViewItemC = (SearchView) menu.findItem(R.id.search).getActionView(); searchViewItemC.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); String[] from = {SearchManager.SUGGEST_COLUMN_ICON_1, SearchManager.SUGGEST_COLUMN_TEXT_1, SearchManager.SUGGEST_COLUMN_TEXT_2}; int[] to = {R.id.posterPath, R.id.title, R.id.info}; searchAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.suggestionrow, null, from, to, 0) { @Override public void changeCursor(Cursor cursor) { super.swapCursor(cursor); } }; searchViewItemC.setSuggestionsAdapter(searchAdapter); MenuItemCompat.setOnActionExpandListener(searchViewItem, onSearchViewItemExpand); return true; }
Example #28
Source File: SearchActivity.java From RetroMusicPlayer with GNU General Public License v3.0 | 5 votes |
private void setupSearchView() { SearchManager searchManager = (SearchManager) getSystemService(SEARCH_SERVICE); mSearchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); mSearchView.setQueryHint(getString(R.string.search_hint)); mSearchView.setImeOptions(mSearchView.getImeOptions() | EditorInfo.IME_ACTION_SEARCH | EditorInfo.IME_FLAG_NO_EXTRACT_UI | EditorInfo.IME_FLAG_NO_FULLSCREEN); mSearchView.post(() -> mSearchView.setOnQueryTextListener(SearchActivity.this)); mSearchView.onActionViewExpanded(); mSearchView.setIconified(false); }
Example #29
Source File: OrdersFragment.java From Woodmin with Apache License 2.0 | 5 votes |
protected void onNewIntent(Intent intent) { String action = intent.getAction(); if (action != null && (action.equals(Intent.ACTION_SEARCH) || action.equals(SearchIntents.ACTION_SEARCH))) { mQuery = intent.getStringExtra(SearchManager.QUERY); mQuery = mQuery.replace(getString(R.string.order_voice_search) + " ",""); } }
Example #30
Source File: MainActivity.java From android-BasicContactables with Apache License 2.0 | 5 votes |
@Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search).getActionView(); searchView.setSearchableInfo( searchManager.getSearchableInfo(getComponentName())); return true; }