IT. Expert System.

Android Reference

SearchRecentSuggestions


android.provider

Class SearchRecentSuggestions



  • public class SearchRecentSuggestions
    extends Object
    This is a utility class providing access to SearchRecentSuggestionsProvider.

    Unlike some utility classes, this one must be instantiated and properly initialized, so that it can be configured to operate with the search suggestions provider that you have created.

    Typically, you will do this in your searchable activity, each time you receive an incoming ACTION_SEARCH Intent. The code to record each incoming query is as follows:

          SearchSuggestions suggestions = new SearchSuggestions(this,
                  MySuggestionsProvider.AUTHORITY, MySuggestionsProvider.MODE);
          suggestions.saveRecentQuery(queryString, null);
     

    For a working example, see SearchSuggestionSampleProvider and SearchQueryResults in samples/ApiDemos/app.

    Developer Guides

    For information about using search suggestions in your application, read the Adding Recent Query Suggestions developer guide.

    • Field Detail

      • QUERIES_PROJECTION_1LINE

        public static final String[] QUERIES_PROJECTION_1LINE
        This is the database projection that can be used to view saved queries, when configured for one-line operation.
      • QUERIES_PROJECTION_2LINE

        public static final String[] QUERIES_PROJECTION_2LINE
        This is the database projection that can be used to view saved queries, when configured for two-line operation.
      • QUERIES_PROJECTION_DATE_INDEX

        public static final int QUERIES_PROJECTION_DATE_INDEX
        Index into the provided query projections. For use with Cursor.update methods.
        See Also:
        Constant Field Values
      • QUERIES_PROJECTION_QUERY_INDEX

        public static final int QUERIES_PROJECTION_QUERY_INDEX
        Index into the provided query projections. For use with Cursor.update methods.
        See Also:
        Constant Field Values
      • QUERIES_PROJECTION_DISPLAY1_INDEX

        public static final int QUERIES_PROJECTION_DISPLAY1_INDEX
        Index into the provided query projections. For use with Cursor.update methods.
        See Also:
        Constant Field Values
      • QUERIES_PROJECTION_DISPLAY2_INDEX

        public static final int QUERIES_PROJECTION_DISPLAY2_INDEX
        Index into the provided query projections. For use with Cursor.update methods.
        See Also:
        Constant Field Values
    • Method Detail

      • saveRecentQuery

        public void saveRecentQuery(String queryString,
                           String line2)
        Add a query to the recent queries list. Returns immediately, performing the save in the background.
        Parameters:
        queryString - The string as typed by the user. This string will be displayed as the suggestion, and if the user clicks on the suggestion, this string will be sent to your searchable activity (as a new search query).
        line2 - If you have configured your recent suggestions provider with SearchRecentSuggestionsProvider.DATABASE_MODE_2LINES, you can pass a second line of text here. It will be shown in a smaller font, below the primary suggestion. When typing, matches in either line of text will be displayed in the list. If you did not configure two-line mode, or if a given suggestion does not have any additional text to display, you can pass null here.
      • clearHistory

        public void clearHistory()
        Completely delete the history. Use this call to implement a "clear history" UI. Any application that implements search suggestions based on previous actions (such as recent queries, page/items viewed, etc.) should provide a way for the user to clear the history. This gives the user a measure of privacy, if they do not wish for their recent searches to be replayed by other users of the device (via suggestions).
      • truncateHistory

        protected void truncateHistory(ContentResolver cr,
                           int maxEntries)
        Reduces the length of the history table, to prevent it from growing too large.
        Parameters:
        cr - Convenience copy of the content resolver.
        maxEntries - Max entries to leave in the table. 0 means remove all entries.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1144 / . Delta: 0.00838 с