List of usage examples for android.content Intent ACTION_WEB_SEARCH
String ACTION_WEB_SEARCH
To view the source code for android.content Intent ACTION_WEB_SEARCH.
Click Source Link
From source file:Main.java
public static void searchWeb(Context context, String word) { Intent i = new Intent(Intent.ACTION_WEB_SEARCH); i.putExtra(SearchManager.QUERY, word); context.startActivity(i);// w ww . j a va2s . c om }
From source file:Main.java
public static void searchContent(Context context, String content) { Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, content); context.startActivity(intent);/*from w w w . ja v a2 s.c o m*/ }
From source file:Main.java
public static void showGoogleSearchIntent(Context context, String query) { Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, query); // query contains search string context.startActivity(intent);/* ww w . j a v a 2 s. com*/ }
From source file:Main.java
@NonNull public static Intent search(@NonNull String query) { final Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, query); return intent; }
From source file:Main.java
public static Intent webSearch(String query) { final Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, query); return intent; }
From source file:Main.java
/** * When doing a web search, there are two situations. * * If user type in a url or something similar to a url, we need to * open the url directly for user. Otherwise, we just search the * content user type in with default search engine. * * @param str content user want to search or url user want to visit * @return intent//from www . j a v a2 s .c om */ public static Intent getWebSearchIntent(String str) { Intent intent; // if search content contain ".", we think it's a url if (str.contains(".")) { if (!str.startsWith("http://") && !str.startsWith("https://")) str = "http://" + str; intent = new Intent(Intent.ACTION_VIEW, Uri.parse(str)); } else { intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, str); } return intent; }
From source file:com.android.common.util.IntentUtils.java
/** * Search a word in a browser//from w w w .j av a 2 s.co m * * @param context * @param string */ public static void search(Context context, String string) { Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, string); context.startActivity(intent); }
From source file:com.hch.beautyenjoy.tools.IntentUtils.java
/** * Search a word in a browser/*from w ww . java 2 s . c o m*/ */ public static void search(Context context, String string) { Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, string); ComponentName componentName = intent.resolveActivity(context.getPackageManager()); if (componentName != null) { context.startActivity(intent); } }
From source file:com.bar.foldinglayout.sample.FoldingPaneLayoutActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action buttons switch (item.getItemId()) { case R.id.action_websearch: // create intent to perform web search for this planet Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getSupportActionBar().getTitle()); // catch event that there's no activity to handle intent if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent);/*w ww.j a va2 s. com*/ } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.popofibo.weatherpop.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { if (drawToggle.onOptionsItemSelected(item)) { return true; }//from w w w . j a v a 2 s . c o m switch (item.getItemId()) { case R.id.action_websearch: Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); intent.putExtra(SearchManager.QUERY, getActionBar().getTitle()); if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(this, R.string.app_not_available, Toast.LENGTH_LONG).show(); } return true; case R.id.action_refresh: intent = new Intent(this, WeatherPopDisplayActivity.class); intent.putExtra(WeatherPopConstants.EXTRA_MESSAGE, message); intent.putExtra(WeatherPopConstants.EXTRA_OPTION, option); startActivity(intent); default: return super.onOptionsItemSelected(item); } }