Help is needed. In the toolbar there is a search where information will be entered and when you click on the keyboard, enter Google will open Google with the data entered. In no way can I understand in the documentation and examples how to make a search that should search for information in Google. At the moment, came up with the only way: transfer entered through the intent
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(**данные**)); startActivity(intent); but I do not understand how to get this data to make castes in a string for this method
public Intent(String action, Uri uri, Context packageContext, Class<?> cls) { setAction(action); mData = uri; mComponent = new ComponentName(packageContext, cls); } It seems to me that there is some other way, a little clearer.
Here is my code:
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater menuInflater = getMenuInflater(); menuInflater.inflate(R.menu.menu_toolbar, menu); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.action_search).getActionView(); searchView.setSearchableInfo(searchManager.getSearchableInfo(getComponentName())); return super.onCreateOptionsMenu(menu); } @Override public boolean onOptionsItemSelected(MenuItem item) { transaction = manager.beginTransaction(); switch (item.getItemId()) { case R.id.action_map: transaction.replace(R.id.container, new MapsFragment()).commit(); return true; case R.id.action_search: return true; default: return super.onOptionsItemSelected(item); } }