Reputation: 1256
I was trying to launch an Intent
which will launch a browser and search query on Google. But the problem is that it is directly launching the search query on Google app instead of any browser. I have tested this on emulator and also in my Android device.
My Approach :
Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
intent.putExtra(SearchManager.QUERY,queryText);
startActivity(intent);
Upvotes: 1
Views: 630
Reputation: 583
you can open browser using below intent
try{
String escapedQuery = URLEncoder.encode("Android developer", "UTF-8");
Uri uri = Uri.parse("http://www.google.com/#q=" + escapedQuery);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}catch (Exception e){
e.printStackTrace();
}
Upvotes: 2