Questions tagged [android-search]

Search is a core user feature on Android. Users should be able to search any data that is available to them, whether the content is located on the device or the Internet. To help create a consistent search experience for users, Android provides a search framework that helps you implement search for your application.

The search framework offers two modes of search input: a search dialog at the top of the screen or a search widget (SearchView) that you can embed in your activity layout. In either case, the Android system will assist your search implementation by delivering search queries to a specific activity that performs searchs. You can also enable either the search dialog or widget to provide search suggestions as the user types. Figure 1 shows an example of the search dialog with optional search suggestions.

Once you've set up either the search dialog or the search widget, you can:

  • Enable voice search
  • Provide search suggestions based on recent user queries
  • Provide custom search suggestions that match actual results in your application data
  • Offer your application's search suggestions in the system-wide Quick Search Box

The following documents show you how to use Android's framework to implement search:

Creating a Search Interface:

How to set up your application to use the search dialog or search widget.

Adding Recent Query Suggestions:

How to provide suggestions based on queries previously used.

Adding Custom Suggestions:

How to provide suggestions based on custom data from your application and also offer them in the system-wide Quick Search Box.

Searchable Configuration:

A reference document for the searchable configuration file (though the other documents also discuss the configuration file in terms of specific behaviors).

413 questions
142
votes
11 answers

MenuItemCompat.getActionView always returns null

I just implemented the v7 AppCompat support library but the MenuItemCompat.getActionView always return null in every Android version I tested (4.2.2, 2.3.4 ....) The SearchView is displayed in action bar but it doesn't respond to touch actions and…
Mohsen Afshin
  • 13,273
  • 10
  • 65
  • 90
92
votes
11 answers

How to remove white underline in a SearchView widget in Toolbar Android

I am using the Toolbar search widget in my project. Everything works fine but expect the thing which I am completely stuck up with removing the underline below the search field in my toolbar. I have tried many solutions and nothing works out. Below…
Chandru
  • 5,954
  • 11
  • 45
  • 85
27
votes
5 answers

Custom SearchView whole clickable in android

I have a SearchView widget in my app, and I want to ask some questions about making it custom. First of all, you can start search only by clicking on search icon, is there any way to make whole SearchView clickable? Also, is there a way to make…
Anhayt Ananun
  • 896
  • 1
  • 11
  • 27
26
votes
3 answers

How to implement Search Bar like gmail app in android?

I am trying to implement the Search functionality in my android app similar to latest gmail app (search icon in the action bar). On tapping the Search icon, the action bar turns into a search field with a back button on the left side, and a…
25
votes
9 answers

How to change SearchView elements' color?

I want to use SearchView in my project, but I have a problem with elements' color. Let me show you: its fragmentDialog where I have my SearchView I dont need to change bg color. The next picture is for example. I want to see SearchView elements…
Alex Smith
  • 616
  • 2
  • 7
  • 16
24
votes
5 answers

How to detect SearchView's back button press?

I'm using a single activity to display SearchView as well as to display search results. The search results is just a subset of items so the search acts as a filter. Everything seems to work fine except that I can't figure out how to restore all…
bdristan
  • 1,048
  • 1
  • 12
  • 36
22
votes
3 answers

Global search not working as expected in Android 4.4

I've got an application that has two search suggestion providers that both extend SearchRecentSuggestionsProvider, and I've set it up correctly in the manifest file with the following Intent filter and meta-data:
Michell Bak
  • 13,182
  • 11
  • 64
  • 121
21
votes
7 answers

SearchInfo always coming out null

I'm having trouble setting up the search view in the action bar. I followed the developer site, but it doesn't work. I get the feeling that I am missing something. When I run my code, it always outputs "failed to get searchable info"…
Kpaekn
  • 339
  • 3
  • 9
20
votes
3 answers

How to programmatically initiate a Google Now voice search?

I want to start a Google Now voice search when the user presses a button. However, I can't find the Intent to start the search in the docs. Does anybody know how to start activity for Google Now voice Search?
patil215
  • 203
  • 1
  • 2
  • 6
19
votes
3 answers

Action bar - ifRoom option leaving too much space

I have a problem on my Action bar, I tried to setup a search view on it in order to get a a search bar expandable. This is woking well except the fact that I had to set all the other menu items with the option ifRoom in order to let the search field…
Yoann Hercouet
  • 17,894
  • 5
  • 58
  • 85
17
votes
6 answers

how do I highlight the searched text in my search filter?

I am trying to do a search such that all the "visible" search letters should be highlighted. I tried using spannable but that didn't do the trick, maybe I wasnt doing it right? based on this: Highlight searched text in ListView items How do i get to…
user2386226
16
votes
4 answers

Is there any listener on Android SearchView to notify if SearchView is expanded and ready to take input?

I want to show some default suggestions in SearchView when User hasn't typed anything. I am setting my custom suggestion adapter manually using matrix cursor. I tried setting adapter in onFocusChange and onClickListner but suggestions get hidden…
Pradeep Sharma
  • 327
  • 4
  • 15
15
votes
9 answers

Throttle onQueryTextChange in SearchView

What's the best way to "throttle" onQueryTextChange so that my performSearch() method is called only once every second instead of every time the user types? public boolean onQueryTextChange(final String newText) { if (newText.length() > 3) { …
aherrick
  • 19,799
  • 33
  • 112
  • 188
15
votes
6 answers

How to handle back button of Search View in android

I have Develop an application that have search view in action bar and i got issue when i am do search its filter perfectly but when i am press back button its still showing filter data so my question is what is event of back button of Action Bar…
Android_Paradise
  • 325
  • 1
  • 5
  • 15
15
votes
2 answers

How to remove android searchview popup text while searching?

I have implemented action bar SearchView , it's working fine but at the bottom of the screen a floating text popup is shown. See screenshot: ListView Java class: @Override public boolean onQueryTextChange(String newText) { if…
venu
  • 2,971
  • 6
  • 40
  • 59
1
2 3
27 28