Build 1.0_r1(from source)

android.content
Class SearchRecentSuggestionsProvider

java.lang.Object
  extended by android.content.ContentProvider
      extended by android.content.SearchRecentSuggestionsProvider
All Implemented Interfaces:
ComponentCallbacks

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.

See Also:
SearchRecentSuggestions

Nested Class Summary
 
Nested classes/interfaces inherited from class android.content.ContentProvider
ContentProvider.Transport
 
Field Summary
static int DATABASE_MODE_2LINES
          This mode bit configures the database to include a 2nd annotation line with each entry.
static int DATABASE_MODE_QUERIES
          This mode bit configures the database to record recent queries.
 
Constructor Summary
SearchRecentSuggestionsProvider()
           
 
Method Summary
 int delete(Uri uri, String selection, String[] selectionArgs)
          This method is provided for use by the ContentResolver.
 String getType(Uri uri)
          This method is provided for use by the ContentResolver.
 Uri insert(Uri uri, ContentValues values)
          This method is provided for use by the ContentResolver.
 boolean onCreate()
          This method is provided for use by the ContentResolver.
 Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
          This method is provided for use by the ContentResolver.
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.
 int update(Uri uri, ContentValues values, String selection, String[] selectionArgs)
          This method is provided for use by the ContentResolver.
 
Methods inherited from class android.content.ContentProvider
attachInfo, bulkInsert, coerceToLocalContentProvider, getContext, getIContentProvider, getReadPermission, getSyncAdapter, getWritePermission, isTemporary, onConfigurationChanged, onLowMemory, openFile, openFileHelper, setReadPermission, setWritePermission
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_MODE_QUERIES

public static final int DATABASE_MODE_QUERIES
This mode bit configures the database to record recent queries. required

See Also:
setupSuggestions(String, int), Constant Field Values

DATABASE_MODE_2LINES

public static final int DATABASE_MODE_2LINES
This mode bit configures the database to include a 2nd annotation line with each entry. optional

See Also:
setupSuggestions(String, int), Constant Field Values
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.
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.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature