From the course: Android App Development: Accessibility

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Handle custom accessibility actions

Handle custom accessibility actions - Android Tutorial

From the course: Android App Development: Accessibility

Start my 1-month free trial

Handle custom accessibility actions

- [Instructor] Now that we have all the actions accessibility service, we will report that there will be additional actions available. However, we still don't know what to do when the user performs the action. To do that, all we need to do is to override a new method. So hit command N or alt insert, override method, and select perform accessibility action. Notice that this method returns a Boolean. If it's true, it means that the action was successfully completed and false means the action was not completed. It also accepts an action ID so this is what we're gonna use to determine which action the user clicked. So here we're going to do a switch action and based on the ID, we will do the action that we need. So for the first case, which is the like button, we're going just to call holder.onClick and then pass the button. This is exactly the same method that is called when the user clicks the button. Notice that we also have the problem that the holder is not final. Hit alt enter and…

Contents