Aracılığıyla paylaş


Activity.StartSearch(String, Boolean, Bundle, Boolean) Method

Definition

This hook is called to launch the search UI.

[Android.Runtime.Register("startSearch", "(Ljava/lang/String;ZLandroid/os/Bundle;Z)V", "GetStartSearch_Ljava_lang_String_ZLandroid_os_Bundle_ZHandler")]
public virtual void StartSearch (string? initialQuery, bool selectInitialQuery, Android.OS.Bundle? appSearchData, bool globalSearch);
[<Android.Runtime.Register("startSearch", "(Ljava/lang/String;ZLandroid/os/Bundle;Z)V", "GetStartSearch_Ljava_lang_String_ZLandroid_os_Bundle_ZHandler")>]
abstract member StartSearch : string * bool * Android.OS.Bundle * bool -> unit
override this.StartSearch : string * bool * Android.OS.Bundle * bool -> unit

Parameters

initialQuery
String

Any non-null non-empty string will be inserted as pre-entered text in the search query box.

selectInitialQuery
Boolean

If true, the initial query will be preselected, which means that any further typing will replace it. This is useful for cases where an entire pre-formed query is being inserted. If false, the selection point will be placed at the end of the inserted query. This is useful when the inserted query is text that the user entered, and the user would expect to be able to keep typing. This parameter is only meaningful if initialQuery is a non-empty string.

appSearchData
Bundle

An application can insert application-specific context here, in order to improve quality or specificity of its own searches. This data will be returned with SEARCH intent(s). Null if no extra data is required.

globalSearch
Boolean

If false, this will only launch the search that has been specifically defined by the application (which is usually defined as a local search). If no default search is defined in the current application or activity, global search will be launched. If true, this will always launch a platform-global (e.g. web-based) search instead.

Attributes

Remarks

This hook is called to launch the search UI.

It is typically called from onSearchRequested(), either directly from Activity.onSearchRequested() or from an overridden version in any given Activity. If your goal is simply to activate search, it is preferred to call onSearchRequested(), which may have been overridden elsewhere in your Activity. If your goal is to inject specific data such as context data, it is preferred to override onSearchRequested(), so that any callers to it will benefit from the override.

Note: when running in a Configuration#UI_MODE_TYPE_WATCH, use of this API is not supported.

Java documentation for android.app.Activity.startSearch(java.lang.String, boolean, android.os.Bundle, boolean).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also