Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/373.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从Android应用程序上搜索images.google.com_Java_Android - Fatal编程技术网

Java 从Android应用程序上搜索images.google.com

Java 从Android应用程序上搜索images.google.com,java,android,Java,Android,我是第一次开发android应用程序。 我可以使用以下代码进行www.google.com搜索: public void onSearchClick(View v) { try { Intent intent = new Intent(Intent.ACTION_WEB_SEARCH); String term = editText.getText().toString(); intent.putExtra(SearchManage

我是第一次开发android应用程序。 我可以使用以下代码进行www.google.com搜索:

    public void onSearchClick(View v) {
    try {
        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
        String term = editText.getText().toString();
        intent.putExtra(SearchManager.QUERY, term);
        startActivity(intent);
    } catch (Exception ex) {

    }

}
但是也可以在images.google.com上进行类似的搜索(在editText小部件中填充一个单词)吗?
提前谢谢。

我找不到优雅的方式。但是您可以使用这个:)
intent=newintent(intent.ACTION\u视图,Uri.parse(“http://images.google.com/search?num=10&hl=en&site=&tbm=isch&source=hp‌​&白车身=1366&bih=667&q=cars&oq=cars&gs_l=img.3..0l10.748.1058.0.1306.4.4.0.0.0.165‌​.209.2j1.3.0…0.0…1ac.1.8RNsNEqlcZc”)
where
q='你的搜索文本'

晚会迟到了一点

我也在尝试做同样的事情,但我无意中发现了这一点 ,并发现下面的查询应该更“优雅”-但当然不能保证谷歌不会改变它-:

以“猎豹”为例进行查询

https://www.google.com/search?tbm=isch&q=cheetah 
我们应该做到这一点


这应该接近Shashank Kadne在上述评论中的建议

我不想通过提供图片来搜索的副本。我想通过提供一个词来搜索正常的方式。一个简单的
intent=newintent(intent.ACTION\u视图,Uri.parse(“http://images.google.com"));
会带你去谷歌图片,你可以在那里搜索。如果这是你需要的,我会把这个作为我的答案,这样你就可以接受:)我肯定这不是正确的方法。但它是有效的。Try
intent=newintent(intent.ACTION\u视图,Uri.parse(“http://images.google.com/search?num=10&hl=en&site=&tbm=isch&source=hp&biw=1366&bih=667&q=cars&oq=cars&gs_l=img.3..0l10.748.1058.0.1306.4.4.0.0.0.0.165.209.2j1.3.0...0.0...1ac.1.8RNsNEqlcZc"));
请注意,在url中,而不是
q=cars
,为您的edittext值。这应该有效。