Share via


InputMethodManager.HideSoftInputFromWindow Method

Definition

Overloads

HideSoftInputFromWindow(IBinder, HideSoftInputFlags, ResultReceiver)

Request to hide the soft input window from the context of the window that is currently accepting input.

HideSoftInputFromWindow(IBinder, HideSoftInputFlags)

Synonym for #hideSoftInputFromWindow(IBinder, int, ResultReceiver) without a result: request to hide the soft input window from the context of the window that is currently accepting input.

HideSoftInputFromWindow(IBinder, HideSoftInputFlags, ResultReceiver)

Request to hide the soft input window from the context of the window that is currently accepting input.

[Android.Runtime.Register("hideSoftInputFromWindow", "(Landroid/os/IBinder;ILandroid/os/ResultReceiver;)Z", "")]
public bool HideSoftInputFromWindow(Android.OS.IBinder? windowToken, Android.Views.InputMethods.HideSoftInputFlags flags, Android.OS.ResultReceiver? resultReceiver);
[<Android.Runtime.Register("hideSoftInputFromWindow", "(Landroid/os/IBinder;ILandroid/os/ResultReceiver;)Z", "")>]
member this.HideSoftInputFromWindow : Android.OS.IBinder * Android.Views.InputMethods.HideSoftInputFlags * Android.OS.ResultReceiver -> bool

Parameters

windowToken
IBinder

The token of the window that is making the request, as returned by View#getWindowToken() View.getWindowToken().

flags
HideSoftInputFlags

Provides additional operating flags. Currently may be 0 or have the #HIDE_IMPLICIT_ONLY bit set.

resultReceiver
ResultReceiver

If non-null, this will be called by the IME when it has processed your request to tell you what it has done. The result code you receive may be either #RESULT_UNCHANGED_SHOWN, #RESULT_UNCHANGED_HIDDEN, #RESULT_SHOWN, or #RESULT_HIDDEN.

Returns

true if a request was sent to system_server, false otherwise. Note: This does not return the result of that request (i.e. whether the IME was actually hidden). For result use instead.

Attributes

Remarks

Request to hide the soft input window from the context of the window that is currently accepting input. This should be called as a result of the user doing some actually than fairly explicitly requests to have the input window hidden.

<strong>Caveat:</strong> ResultReceiver instance passed to this method can be a long-lived object, because it may not be garbage-collected until all the corresponding ResultReceiver objects transferred to different processes get garbage-collected. Follow the general patterns to avoid memory leaks in Android. Consider to use java.lang.ref.WeakReference so that application logic objects such as android.app.Activity and Context can be garbage collected regardless of the lifetime of ResultReceiver.

This member is deprecated. The ResultReceiver is not a reliable way of determining whether the Input Method is actually shown or hidden. If result is needed, use android.view.WindowInsetsController#hide instead and set a View.OnApplyWindowInsetsListener and verify the provided WindowInsets for the visibility of IME. If result is not needed, use #hideSoftInputFromView(View, int) instead.

Java documentation for android.view.inputmethod.InputMethodManager.hideSoftInputFromWindow(android.os.IBinder, int, android.os.ResultReceiver).

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

HideSoftInputFromWindow(IBinder, HideSoftInputFlags)

Synonym for #hideSoftInputFromWindow(IBinder, int, ResultReceiver) without a result: request to hide the soft input window from the context of the window that is currently accepting input.

[Android.Runtime.Register("hideSoftInputFromWindow", "(Landroid/os/IBinder;I)Z", "")]
public bool HideSoftInputFromWindow(Android.OS.IBinder? windowToken, Android.Views.InputMethods.HideSoftInputFlags flags);
[<Android.Runtime.Register("hideSoftInputFromWindow", "(Landroid/os/IBinder;I)Z", "")>]
member this.HideSoftInputFromWindow : Android.OS.IBinder * Android.Views.InputMethods.HideSoftInputFlags -> bool

Parameters

windowToken
IBinder

The token of the window that is making the request, as returned by View#getWindowToken() View.getWindowToken().

flags
HideSoftInputFlags

Provides additional operating flags. Currently may be 0 or have the #HIDE_IMPLICIT_ONLY bit set.

Returns

<p>For apps targeting Android Build.VERSION_CODES.BAKLAVA, onwards, it will always return true. To see when the IME is hidden, use View.OnApplyWindowInsetsListener and verify the provided WindowInsets for the visibility of IME.

        &lt;p&gt;For apps targeting releases before Android Baklava: returns <code data-dev-comment-type="c">true</code> if a request
        was sent to system_server, <code data-dev-comment-type="c">false</code> otherwise. Note: This does not return the result
        of that request (i.e. whether the IME was actually hidden).
Attributes

Remarks

Synonym for #hideSoftInputFromWindow(IBinder, int, ResultReceiver) without a result: request to hide the soft input window from the context of the window that is currently accepting input.

Java documentation for android.view.inputmethod.InputMethodManager.hideSoftInputFromWindow(android.os.IBinder, int).

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