I am implementing a SearchView on ActionBar with ActionBarSherlock. I went through the documentation on this topic: http://developer.android.com/guide/topics/search/index.html but I am confused:
(1) It seems the framework pushes you to use ContentProvider for suggestions and SearchView retrieves the suggestions by calling the ContentProvider.query()
method. However, I don't think I can use this framework because I will get my suggestions from a server. That is, I will provide a keyword to call an api, after the data is fetched, a callback function will be called. So it is async so that the query() method won't work. Can I get rid of the ContentProvider to implement the suggestions?
(2) My suggestion items should be customized. There will be a CheckBox in each item. So I think I should use a customized adapter. I only found a method setSuggestionAdapter()
in SearchView which only receives CursorAdapter. From my knowledge, CursorAdapter is used for database query. However there is no database concept in my case.
(3) It seems you have to bind your SearchView to an Activity. Is it really necessary or can we bind it to a Fragment instead?
Any suggestions for this ? Thanks in advance!