将Google Search API添加到Android App [英] Adding Google Search API to Android App

查看:99
本文介绍了将Google Search API添加到Android App的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将google search api添加到我的应用程序中.搜索结果应显示在列表视图中...任何人都可以给我发送一些示例或告诉我如何做吗?

Hi i would like to add google search api to my application.and the search result should be shown in a list view...can any one send me some example or tell me how to do it??

推荐答案

在这里是

import android.app.SearchManager;

// ...

Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);  
intent.putExtra(SearchManager.QUERY, "Search query");    
startActivity(intent);

基于语音的搜索:

import android.speech.RecognizerIntent;

// ...

Intent sp = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
sp.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
sp.putExtra(RecognizerIntent.EXTRA_PROMPT, "Speak please");
startActivity(sp);

这篇关于将Google Search API添加到Android App的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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