开始从活动谷歌搜索查询 - 机器人 [英] Start Google search query from activity - Android

查看:147
本文介绍了开始从活动谷歌搜索查询 - 机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在想,如果有一个更简单的方法(或任何方式),开始与谷歌搜索查询的浏览器。例如,用户可以选择某个单词或短语,然后点击一个按钮,该活动将开始与谷歌搜索查询的浏览器。

I was wondering if there is an easier way (or any way) to start a Browser with a Google search query. For example user can select a certain word or phrase and click a button and the activity will start the browser with the Google search query.

感谢你。

推荐答案

您可以用code几行做到这一点很容易(假设你要搜索谷歌的鱼):

You can do this quite easily with a few lines of code (assuming you want to search Google for 'fish'):

Uri uri = Uri.parse("http://www.google.com/#q=fish");
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);

另外,如果你宁愿启动自己的活动来处理浏览,你应该能够用的WebView这样做的:<一href="http://developer.android.com/reference/android/webkit/WebView.html">http://developer.android.com/reference/android/webkit/WebView.html

我觉得更好的答案在这里是@ zen_of_kermit的。这将是很好不过,如果允许Android的用户提供的搜索引擎有一个额外的,虽然对 ACTION_WEB_SEARCH ,而不只是使用谷歌。

I think the better answer here is @zen_of_kermit's. It would be nice though, if Android allowed a user to provide the Search engine has an extra though for the ACTION_WEB_SEARCH, rather than just using Google.

这篇关于开始从活动谷歌搜索查询 - 机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆