Android Guides | Samples

Android.Content.SearchRecentSuggestionsProvider Class

This superclass can be used to create a simple search suggestions provider for your application.

See Also: SearchRecentSuggestionsProvider

Syntax

[Android.Runtime.Register("android/content/SearchRecentSuggestionsProvider", DoNotGenerateAcw=true)]
public class SearchRecentSuggestionsProvider : ContentProvider

Remarks

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 Intent.ActionSearch 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 SearchRecentSuggestionsProvider.SetupSuggestions(String,DatabaseMode), 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:

    xml Example

         <!-- 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:

    java Example

         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(String,String).

Developer Guides

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

See Also

[Android Documentation]

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Content.SearchRecentSuggestionsProvider are listed below.

See Also: ContentProvider

Public Constructors

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

override
Delete(Uri, String, String[]) : Int32
This method is provided for use by the ContentResolver.
override
GetType(Uri) : String
This method is provided for use by the ContentResolver.
override
Insert(Uri, ContentValues) : Uri
This method is provided for use by the ContentResolver.
override
OnCreate() : Boolean
This method is provided for use by the ContentResolver.
override
Query(Uri, String[], String, String[], String) : ICursor
This method is provided for use by the ContentResolver.
override
Update(Uri, ContentValues, String, String[]) : Int32
This method is provided for use by the ContentResolver.

Protected Methods

SetupSuggestions(String, DatabaseMode)
In order to use this class, you must extend it, and call this setup function from your constructor.