Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想实现一个搜索功能,打开默认浏览器并搜索传递的字符串
public void searchOnGoogle(String keywords){ --- }
有没有办法使用意图过滤器,或者我必须自己实现一切?
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);