我想实现一个打开默认浏览器并搜索传递的字符串的搜索功能
public void searchOnGoogle(String keywords){
---
}
有没有办法使用 Intent 过滤器,或者我必须自己实现所有内容?
最佳答案
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);
关于android - 如何使用默认浏览器在谷歌上搜索字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13853375/