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
1
vote
0 answers

How to use search functionality from json response in android?

Hi I am using json response with image and text to display in gridview. It has been displayed successfully. I need to use search on top of gridview using edittext. But search is not working when I give input. Here is my code. List ponyList…
1
vote
0 answers

Android Search widget showing suggestions on second character, need to show one user clicks the search view

I am trying to map a arraylist of strings to searchview adapter using a custom adapter. I have tried so many links, everything is working fine except that the suggestions layout is coming when user types the second character. I want to show the…
1
vote
2 answers

Sorting search results (from Android SearchView query) by number of matches

i'm trying to find a good way to sort the search results according to relevance after performing a search with a SearchView in Android. For me relevance means the number of matches in two SQLite text columns I'm using a CursorLoader and there the…
sunyata
  • 1,843
  • 5
  • 27
  • 41
1
vote
1 answer

Disable Long Click on SearchView EditText

I have a SearchView on my Toolbar. I works perfectly and I have no problem with it. But the problem arises whenever I write some search term on the EditText of the SearchView and long-click on the text, the toolbar transforms into a contextual menu…
1
vote
1 answer

Why is Android's SearchView widget's ImageView (with id=search_mag_icon) returning null?

The default SearchView has a search icon in the search hint when it is expanded. I want to remove this icon from the hint. So I saw this answer on SO. It gives the following solution in onCreate(): int magId =…
Solace
  • 8,612
  • 22
  • 95
  • 183
1
vote
1 answer

Is there an advantage to using an Intent over an event listener launch in a search request?

I've looked over SO and cannot find a simple answer. Is there an advantage to using an Intent over an event listener on the search box for sending the text to the query event? SearchView searchView = (SearchView)…
Kazinsky
  • 55
  • 8
1
vote
1 answer

Android : AppCompatActivity ,adding search to toolbar

I am trying to add search functionality to search an item from the list in an activity.I am trying it for android 5.1 and i want to support backward compatibility.I am using android-support-v7-appcompat. MainActiviy : public class MainActivity…
Meher
  • 2,545
  • 3
  • 26
  • 53
1
vote
5 answers

How to let SearchView keep its last query content after reopen?

When using search view, I have a requirement from customer that they want to retain the search content after reopen the search view. My Search view is on a list view and do a real timing filtering based on what user input into the search box. When…
1
vote
0 answers

java.lang.NullPointerException SearchView OnCreateOptionsMenu

I am trying to make my app work for Gingerbread (API 10). My app crashes when I click on the menu with following error - java.lang.NullPointerException at com.sample.appdemo.onCreateOptionsMenu(AppDemoListActivity.java:83) My app worked…
1
vote
2 answers

Android SearchView not working in fragment

I am trying to implement a searchview that is only required in one fragment. It will filter on a listview. import android.os.Bundle; import android.app.Fragment; import android.view.LayoutInflater; import android.view.View; import…
1
vote
1 answer

How to disable ActionMode in SearchView

When user selects text in SearchView, the ActionMode will appear and show 2 tabs on the top, it seems ugly. I tried some apps from Google like Gmail, inbox, Messenger, they disable the function, but how did they do? I tried to set the style, but…
GhostFlying
  • 809
  • 1
  • 7
  • 17
1
vote
1 answer

Android Loaders: When and why would the data content in the data-source change?

I have read that Loaders monitor the underlying data-source for changes, and load new data whenever it becomes available. My question is that when would the data in the data source change? Any examples will be appreciated. Forexample let's say an…
Solace
  • 8,612
  • 22
  • 95
  • 183
1
vote
6 answers

How to display searchview close icon when expanded in android?

I have an imageView. When i click image, i am hidding image and enabling searchview in expanded. But problem is close icon is not visible. How to make close icon visible when searchview in expanded form? Here is my piece of code: public class…
Shadow
  • 6,864
  • 6
  • 44
  • 93
1
vote
2 answers

Change soft keyboard 'Next' button on Samsung phone

I'm trying to change the soft keyboard 'Go' action on a Samsung S3 & S3 Mini (I think any Samsung) to 'Search' and have it perform certain actions onclick. I have the following at the moment, which works on non Samsung…
1
vote
1 answer

What is the most pleasant way to signal to a user that no search results were found in android?

I have the following problem: I use a ListView-Activity and an arrayadapter to display search results. Now, if there are no search results, the Activity consists only of a blank page. What do you think is the best way to react to such a scenario?…
Sleik
  • 341
  • 4
  • 11