Search code examples
androidsearchserversearchview

How to get data from server when i enter something in search box like auto search?


i trying to implement auto search mechanism in android like google. Here when i enter some words then display related search results in list view. For example i entered 3 letters then display related search results from server, again i will add another letter to previous 3 letters then automatically display related search results with out click search button.I don't know how to do it, every time api calling. How to use Search view option from android xml for searching?


Solution

  • On client side you should with the help of AutoCompleteTextView, Adapter, HTTPClient and other stuff you handle sending a request to server. On server side you implement Filter after querying database. After filter is done - respond result and via AutoCompleteTextView you show suggestions. Then via Adapter you set list.

    Very nice example

    Now when you know which way to search better use google. It is rich on that kind of info and if you face some problems - ask new question with exact! problem. hope it is helpful.