Android app search button

I am trying to make my application implement built-in quick search, similar to how it is done in the app / search / invoke search application in ApiDemos. I tried everything from trying to follow other examples, copying the code exactly the same as in ApiDemos.

Everything I found for the first is related to older versions of the SDK and just does not work. As for the things that I can run and see in ApiDemos, I tried to copy the following

com.example.android.apis.app.SearchInvoke.java com.example.android.apis.app.SearchQueryResults.java com.example.android.apis.app.SearchSuggestionSampleProvider.java res/layout/search_invoke.xml res/layout/search_query_results.xml res/values/arrays.xml res/values/strings.xml res/xml/searchable.xml ... and everything under "Search Samples" in AndroidManifest.xml 

This copy gives me a view that looks exactly like the one that I encounter when starting ApiDemos, but when I click on the search button, in the quick search window, Android always just opens a browser window with Google search results for this query. I just can't find the critical component in ApiDemos that tells android that I want to use my own code to process the search request.

I would really appreciate help in this matter. Both documentation and other online resources seem very inadequate when it comes to this.

Thanks.

+6
android quick-search
source share
4 answers

For reference, four months (and God knows how many attempts) later, I found a piece of documentation that I skipped that contained the entire search string, which launches the browser search results, and does not pass them to my own activity. It all comes down to a small notification: here :

Please note that all user-visible strings must be represented as "@string" links. Hard-coded strings that cannot be localized will not work properly in search metadata.

+10
source share

Read this one first. If this does not help, you can try looking at a search example from one of my books - this example integrates with the quick search field, and perhaps this will give you more tips.

+1
source share

In addition to the examples provided by commonsware.com, you can view the search dictionary in the example 1.6 SDK directory.

http://developer.android.com/guide/samples/SearchableDictionary/index.html

0
source share

I was mistaken before ... the SDK documentation contains an explanation in the documents for SearchManager that I suggest you take a look at. Also, as mentioned in CommonsWare, a blog post is also a good resource.

0
source share

All Articles