SearchManager.StartSearch Method

Definition

Launch search UI.

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

Parameters

initialQuery
String

A search string can be pre-entered here, but this is typically null or empty.

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.

launchActivity
ComponentName

The ComponentName of the activity that has launched this search.

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

Launch search UI.

The search manager will open a search widget in an overlapping window, and the underlying activity may be obscured. The search entry state will remain in effect until one of the following events: <ul> <li>The user completes the search. In most cases this will launch a search intent.</li> <li>The user uses the back, home, or other keys to exit the search.</li> <li>The application calls the #stopSearch method, which will hide the search window and return focus to the activity from which it was launched.</li>

Most applications will not use this interface to invoke search. The primary method for invoking search is to call android.app.Activity#onSearchRequested Activity.onSearchRequested() or android.app.Activity#startSearch Activity.startSearch().

Java documentation for android.app.SearchManager.startSearch(java.lang.String, boolean, android.content.ComponentName, 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