Adding Google Search API to Android App [closed]

非 Y 不嫁゛ 提交于 2019-12-20 14:11:09

问题


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??


回答1:


Here it is:

import android.app.SearchManager;

// ...

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

Voice-based search:

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);



回答2:


Here is a good example on implementing google search in your android application Implementing google search .Hope it helps.



来源:https://stackoverflow.com/questions/19492869/adding-google-search-api-to-android-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!