IT. Expert System.

Android Reference

SearchRecentSuggestionsProvider


android.content

Class SearchRecentSuggestionsProvider

  • All Implemented Interfaces:
    ComponentCallbacks, ComponentCallbacks2
    Direct Known Subclasses:
    TestProvider


    public class SearchRecentSuggestionsProvider
    extends ContentProvider
    This superclass can be used to create a simple search suggestions provider for your application. It creates suggestions (as the user types) based on recent queries and/or recent views.

    In order to use this class, you must do the following.

    • Implement and test query search, as described in SearchManager. (This provider will send any suggested queries via the standard ACTION_SEARCH Intent, which you'll already support once you have implemented and tested basic searchability.)
    • Create a Content Provider within your application by extending SearchRecentSuggestionsProvider. The class you create will be very simple - typically, it will have only a constructor. But the constructor has a very important responsibility: When it calls setupSuggestions(String, int), it configures the provider to match the requirements of your searchable activity.
    • Create a manifest entry describing your provider. Typically this would be as simple as adding the following lines:
           <!-- Content provider for search suggestions -->
           <provider android:name="YourSuggestionProviderClass"
                     android:authorities="your.suggestion.authority" />
    • Please note that you do not instantiate this content provider directly from within your code. This is done automatically by the system Content Resolver, when the search dialog looks for suggestions.
    • In order for the Content Resolver to do this, you must update your searchable activity's XML configuration file with information about your content provider. The following additions are usually sufficient:
           android:searchSuggestAuthority="your.suggestion.authority"
           android:searchSuggestSelection=" ? "
    • In your searchable activities, capture any user-generated queries and record them for future searches by calling SearchRecentSuggestions.saveRecentQuery().

    Developer Guides

    For information about using search suggestions in your application, read the Search developer guide.

    See Also:
    SearchRecentSuggestions
    • Constructor Detail

      • SearchRecentSuggestionsProvider

        public SearchRecentSuggestionsProvider()
    • Method Detail

      • setupSuggestions

        protected void setupSuggestions(String authority,
                            int mode)
        In order to use this class, you must extend it, and call this setup function from your constructor. In your application or activities, you must provide the same values when you create the SearchRecentSuggestions helper.
        Parameters:
        authority - This must match the authority that you've declared in your manifest.
        mode - You can use mode flags here to determine certain functional aspects of your database. Note, this value should not change from run to run, because when it does change, your suggestions database may be wiped.
        See Also:
        DATABASE_MODE_QUERIES, DATABASE_MODE_2LINES
      • delete

        public int delete(Uri uri,
                 String selection,
                 String[] selectionArgs)
        This method is provided for use by the ContentResolver. Do not override, or directly call from your own code.
        Specified by:
        delete in class ContentProvider
        Parameters:
        uri - The full URI to query, including a row ID (if a specific record is requested).
        selection - An optional restriction to apply to rows when deleting.
        Returns:
        The number of rows affected.
      • getType

        public String getType(Uri uri)
        This method is provided for use by the ContentResolver. Do not override, or directly call from your own code.
        Specified by:
        getType in class ContentProvider
        Parameters:
        uri - the URI to query.
        Returns:
        a MIME type string, or null if there is no type.
      • insert

        public Uri insert(Uri uri,
                 ContentValues values)
        This method is provided for use by the ContentResolver. Do not override, or directly call from your own code.
        Specified by:
        insert in class ContentProvider
        Parameters:
        uri - The content:// URI of the insertion request.
        values - A set of column_name/value pairs to add to the database.
        Returns:
        The URI for the newly inserted item.
      • onCreate

        public boolean onCreate()
        This method is provided for use by the ContentResolver. Do not override, or directly call from your own code.
        Specified by:
        onCreate in class ContentProvider
        Returns:
        true if the provider was successfully loaded, false otherwise
      • query

        public Cursor query(Uri uri,
                   String[] projection,
                   String selection,
                   String[] selectionArgs,
                   String sortOrder)
        This method is provided for use by the ContentResolver. Do not override, or directly call from your own code.
        Specified by:
        query in class ContentProvider
        Parameters:
        uri - The URI to query. This will be the full URI sent by the client; if the client is requesting a specific record, the URI will end in a record number that the implementation should parse and add to a WHERE or HAVING clause, specifying that _id value.
        projection - The list of columns to put into the cursor. If null all columns are included.
        selection - A selection criteria to apply when filtering rows. If null then all rows are included.
        selectionArgs - You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings.
        sortOrder - How the rows in the cursor should be sorted. If null then the provider is free to define the sort order.
        Returns:
        a Cursor or null.
      • update

        public int update(Uri uri,
                 ContentValues values,
                 String selection,
                 String[] selectionArgs)
        This method is provided for use by the ContentResolver. Do not override, or directly call from your own code.
        Specified by:
        update in class ContentProvider
        Parameters:
        uri - The URI to query. This can potentially have a record ID if this is an update request for a specific record.
        values - A Bundle mapping from column names to new column values (NULL is a valid value).
        selection - An optional filter to match rows to update.
        Returns:
        the number of rows affected.


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: 1393 / . Delta: 0.02201 с