List of usage examples for android.app SearchManager EXTRA_SELECT_QUERY
String EXTRA_SELECT_QUERY
To view the source code for android.app SearchManager EXTRA_SELECT_QUERY.
Click Source Link
From source file:com.android.launcher2.Launcher.java
/** * Starts the global search activity. This code is a copied from SearchManager *///from ww w . ja va 2 s . co m public void startGlobalSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData, Rect sourceBounds) { final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity(); if (globalSearchActivity == null) { Log.w(TAG, "No global search activity found."); return; } Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setComponent(globalSearchActivity); // Make sure that we have a Bundle to put source in if (appSearchData == null) { appSearchData = new Bundle(); } else { appSearchData = new Bundle(appSearchData); } // Set source to package name of app that starts global search, if not set already. if (!appSearchData.containsKey("source")) { appSearchData.putString("source", getPackageName()); } intent.putExtra(SearchManager.APP_DATA, appSearchData); if (!TextUtils.isEmpty(initialQuery)) { intent.putExtra(SearchManager.QUERY, initialQuery); } if (selectInitialQuery) { intent.putExtra(SearchManager.EXTRA_SELECT_QUERY, selectInitialQuery); } intent.setSourceBounds(sourceBounds); try { startActivity(intent); } catch (ActivityNotFoundException ex) { Log.e(TAG, "Global search activity not found: " + globalSearchActivity); } }
From source file:com.android.soma.Launcher.java
/** * Starts the global search activity. This code is a copied from SearchManager *//*from w ww . j av a 2s. co m*/ private void startGlobalSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData, Rect sourceBounds) { final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity(); if (globalSearchActivity == null) { Log.w(TAG, "No global search activity found."); return; } Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setComponent(globalSearchActivity); // Make sure that we have a Bundle to put source in if (appSearchData == null) { appSearchData = new Bundle(); } else { appSearchData = new Bundle(appSearchData); } // Set source to package name of app that starts global search, if not set already. if (!appSearchData.containsKey("source")) { appSearchData.putString("source", getPackageName()); } intent.putExtra(SearchManager.APP_DATA, appSearchData); if (!TextUtils.isEmpty(initialQuery)) { intent.putExtra(SearchManager.QUERY, initialQuery); } if (selectInitialQuery) { intent.putExtra(SearchManager.EXTRA_SELECT_QUERY, selectInitialQuery); } intent.setSourceBounds(sourceBounds); try { startActivity(intent); } catch (ActivityNotFoundException ex) { Log.e(TAG, "Global search activity not found: " + globalSearchActivity); } }
From source file:com.klinker.android.launcher.launcher3.Launcher.java
/** * Starts the global search activity. This code is a copied from SearchManager */// ww w. j a va 2 s . co m private void startGlobalSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData, Rect sourceBounds) { final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity(); if (globalSearchActivity == null) { Log.w(TAG, "No global search activity found."); return; } Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setComponent(globalSearchActivity); // Make sure that we have a Bundle to put source in if (appSearchData == null) { appSearchData = new Bundle(); } else { appSearchData = new Bundle(appSearchData); } // Set source to package name of app that starts global search if not set already. if (!appSearchData.containsKey("source")) { appSearchData.putString("source", getPackageName()); } intent.putExtra(SearchManager.APP_DATA, appSearchData); if (!TextUtils.isEmpty(initialQuery)) { intent.putExtra(SearchManager.QUERY, initialQuery); } if (selectInitialQuery) { intent.putExtra(SearchManager.EXTRA_SELECT_QUERY, selectInitialQuery); } intent.setSourceBounds(sourceBounds); try { startActivity(intent); } catch (ActivityNotFoundException ex) { Log.e(TAG, "Global search activity not found: " + globalSearchActivity); } }
From source file:com.android.launcher3.Launcher.java
/** * Starts the global search activity. This code is a copied from SearchManager *///w ww . j a va 2s. co m public void startGlobalSearch(String initialQuery, boolean selectInitialQuery, Bundle appSearchData, Rect sourceBounds) { final SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); ComponentName globalSearchActivity = searchManager.getGlobalSearchActivity(); if (globalSearchActivity == null) { Log.w(TAG, "No global search activity found."); return; } Intent intent = new Intent(SearchManager.INTENT_ACTION_GLOBAL_SEARCH); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setComponent(globalSearchActivity); // Make sure that we have a Bundle to put source in if (appSearchData == null) { appSearchData = new Bundle(); } else { appSearchData = new Bundle(appSearchData); } // Set source to package name of app that starts global search if not set already. if (!appSearchData.containsKey("source")) { appSearchData.putString("source", getPackageName()); } intent.putExtra(SearchManager.APP_DATA, appSearchData); if (!TextUtils.isEmpty(initialQuery)) { intent.putExtra(SearchManager.QUERY, initialQuery); } if (selectInitialQuery) { intent.putExtra(SearchManager.EXTRA_SELECT_QUERY, selectInitialQuery); } intent.setSourceBounds(sourceBounds); try { startActivity(intent); } catch (ActivityNotFoundException ex) { Log.e(TAG, "Global search activity not found: " + globalSearchActivity); } }