Partager via


InputMethodManager.SetInputMethod(IBinder, String) Method

Definition

Force switch to a new input method component.

[Android.Runtime.Register("setInputMethod", "(Landroid/os/IBinder;Ljava/lang/String;)V", "")]
public void SetInputMethod (Android.OS.IBinder? token, string? id);
[<Android.Runtime.Register("setInputMethod", "(Landroid/os/IBinder;Ljava/lang/String;)V", "")>]
member this.SetInputMethod : Android.OS.IBinder * string -> unit

Parameters

token
IBinder

Supplies the identifying token given to an input method when it was started, which allows it to perform this operation on itself.

id
String

The unique identifier for the new input method to be switched to.

Attributes

Remarks

Force switch to a new input method component. This can only be called from an application or a service which has a token of the currently active input method.

On Android Build.VERSION_CODES#Q and later devices, the undocumented behavior that token can be null when the caller has Manifest.permission#WRITE_SECURE_SETTINGS is deprecated. Instead, update android.provider.Settings.Secure#DEFAULT_INPUT_METHOD and android.provider.Settings.Secure#SELECTED_INPUT_METHOD_SUBTYPE directly.

This member is deprecated. Use InputMethodService#switchInputMethod(String) instead. This method was intended for IME developers who should be accessing APIs through the service. APIs in this class are intended for app developers interacting with the IME.

Java documentation for android.view.inputmethod.InputMethodManager.setInputMethod(android.os.IBinder, java.lang.String).

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