1

I'm coding an app specifially designed for the blind and vision impaired and I'm trying to override the behavior of TextView when specific AccessibilityEvent are fired. The screen layout consists in 4 TextView arranged vertically that fill the screen. I just want to change the color of the background to reflect which one is "focused" so in my custom TextView I have this method

    @Override
    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {

        System.out.println(event.toString());

        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_ENTER ||
                event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUSED) {
            this.setBackgroundColor(mColorArray[2]);
        }

        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_HOVER_EXIT ||
                event.getEventType() == AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED) {
            this.setBackgroundColor(mColorArray[0]);
        }

        return super.dispatchPopulateAccessibilityEvent(event);         
    }

My problem is that AccessibilityEvent.TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED is never fired. The three others fire correctly when using ExploreByTouch or swiping left/right up/down.

Any help would be greatly appreciated

chopchop
  • 1,905
  • 2
  • 22
  • 37
  • possible duplicate of [AccessibilityService is started but does not receive AccessibilityEvents on JellyBean](http://stackoverflow.com/questions/12019848/accessibilityservice-is-started-but-does-not-receive-accessibilityevents-on-jell) – Sufian May 07 '15 at 09:58
  • Were you able to find a solution to this problem ? – Jai Pandit Jan 08 '19 at 22:28

1 Answers1

0

If I understood correctly, the accepted answer from this link might solve your problem. Be careful that if you set your target sdk to 17, there's some extra similar steps to do as described in the comments of the link.

Well I might have read this too fast, it's strange that some are fired and others are not.

Community
  • 1
  • 1
user1732313
  • 139
  • 1
  • 9