Start the browser with a search query in android.

By | November 16, 2011

In android we can simply start a browser or start the browser with a supplied search query.
Remember that we start the browser using an intent and we can put extra parameters in an intent.
Here in the browser intent we can supply the search query as a “SearchManager.QUERY” and giving the value.

 Intent search = new Intent(Intent.ACTION_WEB_SEARCH);
 search.putExtra(SearchManager.QUERY, "ANDROID");
 startActivity(search);

One thought on “Start the browser with a search query in android.

  1. Richard

    Any idea as to why an android 4.4 phone cant handle this action? Nothing is registered to deal with it – I catch the exception and then use intent.ACTION_VIEW instead with a self constructed google search url.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *