将Google Search API添加到Android应用

use*_*202 7 android google-search-api

嗨,我想将google搜索API添加到我的应用程序中.搜索结果应该显示在列表视图中......任何人都可以给我发送一些示例或者告诉我该怎么做?

Niz*_*zam 6

这里是:

import android.app.SearchManager;

// ...

Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);  
intent.putExtra(SearchManager.QUERY, "Search query");    
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

基于语音的搜索:

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);
Run Code Online (Sandbox Code Playgroud)