Android: How to get search suggestions

早过忘川 提交于 2021-02-06 13:56:31

问题


How to get search suggestions when I type some text in my edittext. I am not talking about the interface, but how do i get the actual suggestions like when you type something in the google search bar. Are there any APIs available?

Thx! Rahul.


回答1:


The Google Suggest API seems to be what you're looking for:

http://blogoscoped.com/archive/2006-08-17-n22.html

You can try it on that page, and it will show you the results of your query as XML, when you click submit.

Then, on Android you would use an XML parser, and there's a good example of that here:

http://www.ibm.com/developerworks/opensource/library/x-android/

Here's the official Android documentation on parsing XML: http://developer.android.com/training/basics/network-ops/xml.html



来源:https://stackoverflow.com/questions/11418403/android-how-to-get-search-suggestions

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