Skip to content

Most visited

Recently visited

navigation

AccessibilityButtonController

public final class AccessibilityButtonController
extends Object

java.lang.Object
   ↳ android.accessibilityservice.AccessibilityButtonController


Controller for the accessibility button within the system's navigation area

This class may be used to query the accessibility button's state and register callbacks for interactions with and state changes to the accessibility button when FLAG_REQUEST_ACCESSIBILITY_BUTTON is set.

Note: This class and FLAG_REQUEST_ACCESSIBILITY_BUTTON should not be used as the sole means for offering functionality to users via an AccessibilityService. Some device implementations may choose not to provide a software-rendered system navigation area, making this affordance permanently unavailable.

Note: On device implementations where the accessibility button is supported, it may not be available at all times, such as when a foreground application uses SYSTEM_UI_FLAG_HIDE_NAVIGATION. A user may also choose to assign this button to another accessibility service or feature. In each of these cases, a registered AccessibilityButtonController.AccessibilityButtonCallback's onAvailabilityChanged(AccessibilityButtonController, boolean) method will be invoked to provide notifications of changes in the accessibility button's availability to the registering service.

Summary

Nested classes

class AccessibilityButtonController.AccessibilityButtonCallback

Callback for interaction with and changes to state of the accessibility button within the system's navigation area. 

Public methods

boolean isAccessibilityButtonAvailable()

Retrieves whether the accessibility button in the system's navigation area is available to the calling service.

void registerAccessibilityButtonCallback(AccessibilityButtonController.AccessibilityButtonCallback callback, Handler handler)

Registers the provided AccessibilityButtonController.AccessibilityButtonCallback for interaction and state change callbacks related to the accessibility button.

void registerAccessibilityButtonCallback(AccessibilityButtonController.AccessibilityButtonCallback callback)

Registers the provided AccessibilityButtonController.AccessibilityButtonCallback for interaction and state changes callbacks related to the accessibility button.

void unregisterAccessibilityButtonCallback(AccessibilityButtonController.AccessibilityButtonCallback callback)

Unregisters the provided AccessibilityButtonController.AccessibilityButtonCallback for interaction and state change callbacks related to the accessibility button.

Inherited methods

From class java.lang.Object

Public methods

isAccessibilityButtonAvailable

added in API level 26
boolean isAccessibilityButtonAvailable ()

Retrieves whether the accessibility button in the system's navigation area is available to the calling service.

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

Returns
boolean true if the accessibility button in the system's navigation area is available to the calling service, false otherwise

registerAccessibilityButtonCallback

added in API level 26
void registerAccessibilityButtonCallback (AccessibilityButtonController.AccessibilityButtonCallback callback, 
                Handler handler)

Registers the provided AccessibilityButtonController.AccessibilityButtonCallback for interaction and state change callbacks related to the accessibility button. The callback will occur on the specified Handler's thread, or on the services's main thread if the handler is null.

Parameters
callback AccessibilityButtonController.AccessibilityButtonCallback: the callback to add, must be non-null

handler Handler: the handler on which the callback should execute, must be non-null

registerAccessibilityButtonCallback

added in API level 26
void registerAccessibilityButtonCallback (AccessibilityButtonController.AccessibilityButtonCallback callback)

Registers the provided AccessibilityButtonController.AccessibilityButtonCallback for interaction and state changes callbacks related to the accessibility button.

Parameters
callback AccessibilityButtonController.AccessibilityButtonCallback: the callback to add, must be non-null

unregisterAccessibilityButtonCallback

added in API level 26
void unregisterAccessibilityButtonCallback (AccessibilityButtonController.AccessibilityButtonCallback callback)

Unregisters the provided AccessibilityButtonController.AccessibilityButtonCallback for interaction and state change callbacks related to the accessibility button.

Parameters
callback AccessibilityButtonController.AccessibilityButtonCallback: the callback to remove, must be non-null

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)