Most visited

Recently visited

Added in API level 1

SearchRecentSuggestionsProvider

public class SearchRecentSuggestionsProvider
extends ContentProvider

java.lang.Object
   ↳ android.content.ContentProvider
     ↳ android.content.SearchRecentSuggestionsProvider


这个超类可以用来为您的应用程序创建一个简单的搜索建议提供程序。 它基于最近的查询和/或最近的视图创建建议(作为用户类型)。

为了使用此课程,您必须执行以下操作。

Developer Guides

有关在应用程序中使用搜索建议的信息,请阅读 Search开发人员指南。

也可以看看:

Summary

Constants

int DATABASE_MODE_2LINES

该模式位将数据库配置为在每个条目中包含第二条注释行。

int DATABASE_MODE_QUERIES

该模式位配置数据库以记录最近的查询。

Inherited constants

From interface android.content.ComponentCallbacks2

Public constructors

SearchRecentSuggestionsProvider()

Public methods

int delete(Uri uri, String selection, String[] selectionArgs)

此方法仅供ContentResolver使用。

String getType(Uri uri)

此方法仅供ContentResolver使用。

Uri insert(Uri uri, ContentValues values)

此方法仅供ContentResolver使用。

boolean onCreate()

此方法仅供ContentResolver使用。

Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

此方法仅供ContentResolver使用。

int update(Uri uri, ContentValues values, String selection, String[] selectionArgs)

此方法仅供ContentResolver使用。

Protected methods

void setupSuggestions(String authority, int mode)

为了使用这个类,你必须扩展它,并从你的构造函数中调用这个设置函数。

Inherited methods

From class android.content.ContentProvider
From class java.lang.Object
From interface android.content.ComponentCallbacks2
From interface android.content.ComponentCallbacks

Constants

DATABASE_MODE_2LINES

Added in API level 1
int DATABASE_MODE_2LINES

该模式位将数据库配置为在每个条目中包含第二条注释行。 可选的

也可以看看:

常量值:2(0x00000002)

DATABASE_MODE_QUERIES

Added in API level 1
int DATABASE_MODE_QUERIES

该模式位配置数据库以记录最近的查询。 需要

也可以看看:

常数值:1(0x00000001)

Public constructors

SearchRecentSuggestionsProvider

Added in API level 1
SearchRecentSuggestionsProvider ()

Public methods

delete

Added in API level 1
int delete (Uri uri, 
                String selection, 
                String[] selectionArgs)

此方法仅供ContentResolver使用。 不要覆盖,或直接从你自己的代码中调用。

Parameters
uri Uri: The full URI to query, including a row ID (if a specific record is requested).
selection String: An optional restriction to apply to rows when deleting.
selectionArgs String
Returns
int The number of rows affected.

getType

Added in API level 1
String getType (Uri uri)

此方法仅供ContentResolver使用。 不要覆盖,或直接从你自己的代码中调用。

Parameters
uri Uri: the URI to query.
Returns
String a MIME type string, or null if there is no type.

insert

Added in API level 1
Uri insert (Uri uri, 
                ContentValues values)

此方法仅供ContentResolver使用。 不要覆盖,或直接从你自己的代码中调用。

Parameters
uri Uri: The content:// URI of the insertion request. This must not be null.
values ContentValues: A set of column_name/value pairs to add to the database. This must not be null.
Returns
Uri The URI for the newly inserted item.

onCreate

Added in API level 1
boolean onCreate ()

此方法仅供ContentResolver使用。 不要覆盖,或直接从你自己的代码中调用。

Returns
boolean true if the provider was successfully loaded, false otherwise

query

Added in API level 1
Cursor query (Uri uri, 
                String[] projection, 
                String selection, 
                String[] selectionArgs, 
                String sortOrder)

此方法仅供ContentResolver使用。 不要覆盖,或直接从你自己的代码中调用。

Parameters
uri 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 String: The list of columns to put into the cursor. If null all columns are included.
selection String: A selection criteria to apply when filtering rows. If null then all rows are included.
selectionArgs String: 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 String: How the rows in the cursor should be sorted. If null then the provider is free to define the sort order.
Returns
Cursor a Cursor or null.

update

Added in API level 1
int update (Uri uri, 
                ContentValues values, 
                String selection, 
                String[] selectionArgs)

此方法仅供ContentResolver使用。 不要覆盖,或直接从你自己的代码中调用。

Parameters
uri Uri: The URI to query. This can potentially have a record ID if this is an update request for a specific record.
values ContentValues: A set of column_name/value pairs to update in the database. This must not be null.
selection String: An optional filter to match rows to update.
selectionArgs String
Returns
int the number of rows affected.

Protected methods

setupSuggestions

Added in API level 1
void setupSuggestions (String authority, 
                int mode)

为了使用这个类,你必须扩展它,并从你的构造函数中调用这个设置函数。 在您的应用程序或活动中,创建SearchRecentSuggestions帮助程序时必须提供相同的值。

Parameters
authority String: This must match the authority that you've declared in your manifest.
mode int: 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.

也可以看看:

Hooray!