AccessibilityService.SoftKeyboardController

public static final class AccessibilityService.SoftKeyboardController
extends Object

java.lang.Object
   ↳ android.accessibilityservice.AccessibilityService.SoftKeyboardController


Used to control and query the soft keyboard show mode.

Summary

Nested classes

interface AccessibilityService.SoftKeyboardController.OnShowModeChangedListener

Listener for changes in the soft keyboard show mode. 

Public methods

void addOnShowModeChangedListener(AccessibilityService.SoftKeyboardController.OnShowModeChangedListener listener, Handler handler)

Adds the specified change listener to the list of soft keyboard show mode change listeners.

void addOnShowModeChangedListener(AccessibilityService.SoftKeyboardController.OnShowModeChangedListener listener)

Adds the specified change listener to the list of show mode change listeners.

int getShowMode()

Returns the show mode of the soft keyboard.

boolean removeOnShowModeChangedListener(AccessibilityService.SoftKeyboardController.OnShowModeChangedListener listener)

Removes the specified change listener from the list of keyboard show mode change listeners.

boolean setShowMode(int showMode)

Sets the soft keyboard show mode.

Inherited methods

Public methods

addOnShowModeChangedListener

added in API level 24
public void addOnShowModeChangedListener (AccessibilityService.SoftKeyboardController.OnShowModeChangedListener listener, 
                Handler handler)

Adds the specified change listener to the list of soft keyboard show mode change listeners. The callback will occur on the specified Handler's thread, or on the services's main thread if the handler is null.

Parameters
listener AccessibilityService.SoftKeyboardController.OnShowModeChangedListener: the listener to add, must be non-null

handler Handler: the handler on which to callback should execute, or null to execute on the service's main thread

addOnShowModeChangedListener

added in API level 24
public void addOnShowModeChangedListener (AccessibilityService.SoftKeyboardController.OnShowModeChangedListener listener)

Adds the specified change listener to the list of show mode change listeners. The callback will occur on the service's main thread. Listener is not called on registration.

Parameters
listener AccessibilityService.SoftKeyboardController.OnShowModeChangedListener

This value must never be null.

getShowMode

added in API level 24
public int getShowMode ()

Returns the show mode of the soft keyboard. The default show mode is SHOW_MODE_AUTO, where the soft keyboard is shown when a text input field is focused. An AccessibilityService can also request the show mode SHOW_MODE_HIDDEN, where the soft keyboard is never shown.

Returns
int the current soft keyboard show mode

Value is SHOW_MODE_AUTO or SHOW_MODE_HIDDEN.

removeOnShowModeChangedListener

added in API level 24
public boolean removeOnShowModeChangedListener (AccessibilityService.SoftKeyboardController.OnShowModeChangedListener listener)

Removes the specified change listener from the list of keyboard show mode change listeners.

Parameters
listener AccessibilityService.SoftKeyboardController.OnShowModeChangedListener: the listener to remove, must be non-null

Returns
boolean true if the listener was removed, false otherwise

setShowMode

added in API level 24
public boolean setShowMode (int showMode)

Sets the soft keyboard show mode. The default show mode is SHOW_MODE_AUTO, where the soft keyboard is shown when a text input field is focused. An AccessibilityService can also request the show mode SHOW_MODE_HIDDEN, where the soft keyboard is never shown. The The lastto this method will be honored, regardless of any previous calls (including those made by other AccessibilityServices).

Note: If the service is not yet connected (e.g. AccessibilityService.onServiceConnected() has not yet been called) or the service has been disconnected, this method will have no effect and return false.

Parameters
showMode int: the new show mode for the soft keyboard

Value is SHOW_MODE_AUTO or SHOW_MODE_HIDDEN.

Returns
boolean true on success