How to search a string on google using default browser
Asked Answered
D

1

9

I want to implement a search function that open the default browser and search the passed string

public void searchOnGoogle(String keywords){
---
}

Is there a way using intent filter or I must implement everything by myself?

Diabolize answered 13/12, 2012 at 5:10 Comment(0)
D
8
String query = URLEncoder.encode(keywords, "utf-8");
String url = "http://www.google.com/search?q=" + query;
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(url));
startActivity(intent);
Debera answered 13/12, 2012 at 5:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.