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

Search Widget Full Width

I'm targetting API level 8+ and I'd like to have a full width search view on top of the action bar, expanded by default and not collapsable. Here's what I did: I've an ActionBar activity where I set inside onCreate: final ActionBar actionBar =…
3
votes
1 answer

Android contact search

I want to implement a contact search with simplecursoradapter. And it should behave like standard android contact search. The problem is I can't write filter right. Now I have something like this: private FilterQueryProvider filterQueryProvider =…
Ov3r1oad
  • 1,057
  • 1
  • 12
  • 25
3
votes
1 answer

MainActivity relaunched onQueryTextSubmit

I've set the searchable config but now am I facing strange problem. While I submit the search query the SearchActivity.class is launched for a second and then goes back to MainActivity.class. I don't know, what happens. See my codes: in…
3
votes
2 answers

How to add extra data to android.widget.SearchView?

I have defined my SearchView like this @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater) SearchManager searchManager = (SearchManager)…
Martynas Jurkus
  • 9,231
  • 13
  • 59
  • 101
3
votes
1 answer

Android Search Interface not submitting query

I've implemented a Search Interface (the Search Widget) by following the official tutorial for Search Interface closely. It all looks good but I can't submit the search query. When I click the "Send" button on the keyboard nothing happens. Here is…
Dominik
  • 1,703
  • 6
  • 26
  • 46
3
votes
2 answers

Android Search Activity and android:launchMode="singleTop"

I have a single activity in my app that uses a SearchView to search (see manifest-- the search intent is intercepted). However, when I press search, nothing happens. The activity never re-starts itself. So, I removed android:launchMode="singleTop"…
Eric Cochran
  • 8,414
  • 5
  • 50
  • 91
3
votes
1 answer

Changing typeface in Android SearchView suggestions

I'm trying to display some ancient Greek words as suggestions for a SearchView, but the native Android typefaces don't support polytonic Greek characters, so I'd like to use a custom font. I know that it's possible to alter the font of the search…
Ben
  • 1,571
  • 1
  • 13
  • 29
3
votes
2 answers

How can I tell when text is being typed into my Android SearchView on the ActionBar

I want to disable certain features of my app while the user is entering text for a search. The xml for the relevant item in my ActionBar is
Stochastically
  • 7,616
  • 5
  • 30
  • 58
2
votes
1 answer

Android searchview filter in recyclerview pagingDataAdapter with Paging3 is not updating the data

I am trying to search a value from database with the search filter. but not updating the searched values in adapter. Note: loading the data using Paging3 library. private val mDiffer: AsyncListDiffer = AsyncListDiffer(this,…
2
votes
1 answer

How to implement a search function in my Android pdf reader app?

I am willing to add search functionality to my pdf reader.I dont know how do i achieve this functionality.Any help would be appreciated. Note:I am using third party library to read the pdf file. Here is the library…
2
votes
1 answer

How to maintain same DataSource for List,Filter and Search in Android Paging Library

I am having activity that displays list of items and also having filter and search option. I am displaying the items using android paging library. First time the List of items will be loaded its working fine when I am Scrolling to bottom next set of…
2
votes
1 answer

How to make search view with modal in Android

I want to make a searchView like this image below. The searchView is received data from local database then it filters data like AutoCompleteTextView. How can i make it? Here is image: enter image description here
2
votes
0 answers

Show SearchView underline in Toolbar on API 23+

My SearchView edit text is not showing any underline. How do I show edit text underline of AppCompat SearchView. I have tried this ((View)searchView.findViewById(android.support.v7.appcompat.R.id.search_src_text) …
Abhishek Bansal
  • 5,197
  • 4
  • 40
  • 69
2
votes
2 answers

How to set searchview text in Android

I try to find a method for setting text for SearchView but I can't find anything? does any one know any method for doing this ? for example something like this searchView.setText("blah blah");
Elnaz
  • 511
  • 5
  • 16
2
votes
0 answers

Changing background of search bar in toolbar to be white?

I implemented a search bar in my toolbar and it currently looks like this: But I want to change the background to white with a shadow so that it looks more like this (taken from Material Design guidelines): How can I do this? Here is my…