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
15
votes
3 answers

Search widget call OnNewIntent twice

I have an activity in which I want to search. When I click to search, event OnNewIntent it is called twice... What I'm doing wrong? I'm creating Searchview like this public override bool OnCreateOptionsMenu(IMenu menu) { searchView = new…
c1rus
  • 156
  • 1
  • 6
13
votes
4 answers

android.support.v4.widget.SearchViewCompat example?

I am trying to use SearchViewCompat with ActionBarSherlock in an API 8 app. public boolean onCreateOptionsMenu(Menu menu) { MenuItem item = menu.add("Search") .setIcon(isLight ? R.drawable.ic_search_inverse : R.drawable.ic_search) …
woodglue
  • 223
  • 2
  • 11
12
votes
2 answers

SearchView in one activity, results in another one

My use case is the following: in activity A, I have an action bar with a collapsible SearchView. When the user gives her query and presses the 'search' button, I would like to show activity B with the results. I'm failing to do so, here is my…
wujek
  • 10,112
  • 12
  • 52
  • 88
12
votes
4 answers

Android Search Activity in Single Activity

I am trying to make my app consist a SINGLE activity. This activity should be able to create a search and also receive a search. Unfortunately, I am getting a "double" search bar in my SearchView when I click on the search button in the action…
Eric Cochran
  • 8,414
  • 5
  • 50
  • 91
11
votes
2 answers

Implementing Search with Room

Recently I have been messing around with Android Architecture Components (more specifically Room) but I have hit a bit of a roadblock. I have successfully built a Room database that stores a list of departments and their personnel. Previously this…
Bryan
  • 14,756
  • 10
  • 70
  • 125
11
votes
1 answer

How add my application content with description and preview to Google search results?

I found this article: A new way to search for content in your apps and I'm really excited for this opportunity. I want to show my application content in google search results, like this: But this article doesn't have any information about how to…
ArtKorchagin
  • 4,801
  • 13
  • 42
  • 58
11
votes
4 answers

Search view close icon appearing disabled rather than white

Whenever I type into my search view the close button (X) appears to be disabled for some reason rather than appearing in the colour white. How can this error be resolved so that it appears white? @Override public void onCreateOptionsMenu(Menu menu,…
wbk727
  • 8,017
  • 12
  • 61
  • 125
10
votes
2 answers

Text input in SearchView doesn't show

I noticed a couple days ago that inputting text in my SearchView doesn't show up. Maybe this problem started longer ago and I hadn't noticed it, but I know that everything was working well when I first set up search functionality. Here is a…
Farbod Salamat-Zadeh
  • 19,687
  • 20
  • 75
  • 125
10
votes
3 answers

Toolbar Search Suggestions Theming

I’m trying to change search suggestions to “light theme”. I’m using appcompat-v7:22.2.0 library and read about new feature for customizing search view widget (android.support.v7.widget.SearchView). FIRST TRY…
10
votes
6 answers

Android SearchView on ActionBar, detect click on Search

In my application, like many other, there is a common search widget (http://developer.android.com/guide/topics/search/search-dialog.html#UsingSearchWidget). I would change fragment (and pass to it the term searched) only when the search button on…
M4rk
  • 2,172
  • 5
  • 36
  • 70
9
votes
1 answer

Can't set OnActionExpandListener: This is not supported, use MenuItemCompat.setOnActionExpandListener()

This sounds like a duplicate question, but it isn't. I'm trying to set an OnActionExpandListener to my search menu item: public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); …
9
votes
0 answers

Implementing Google play and maps like Search Bar android

I have a requirement to create a Google play and maps like search bar with filter in my project, but I have no idea how to start with. I tried it by own custom implementation like as follows: Autocomplete TextView inside ToolBar…
8
votes
1 answer

Change border color of a SearchView

I want to change a border color of my searchview . Right now its coming transparent . I tried giving styling to it but nothing working . SearchView.xml
young_08
  • 1,196
  • 2
  • 13
  • 35
8
votes
1 answer

Android use support library to support SearchView

This is my code: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { MenuItem searchItem = menu.findItem(R.id.searchMenuItem); SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); …
8
votes
1 answer

What's the difference between android.app.default_searchable and android.app.searchable meta-data?

I'm pretty new to Android and I need a search widget to get suggestions from my own dictionary. I realized some tutorials use android.app.default_searchable meta-data and others the android.app.searchable. I can't find the difference explained…
Dpedrinha
  • 3,741
  • 3
  • 38
  • 57
1
2
3
27 28