2

I am quite new in android. I have a problem in handling touch event while talkback is enabled.

I am testing on android 6 ,galaxy S6:

First:I have activated Voice support on the device (Settings\Accessibility\Vision\Talkback).

second : On the page, double clicked at the icon on the screen, it doesn't show the correct coordinates, it seems it keeps the previous value:

This is part of my code, x and y doesn't change while double clicking:

characterCircle.setOnTouchListener(new OnTouchListener() {

        @Override
        public boolean onTouch(View v, MotionEvent event) {
            pinBlock.setLastPinDigit("");
            int [] xLoc = characterCircle.getxLoc();
            int [] yLoc = characterCircle.getyLoc();
            String [] zValue = characterCircle.getzValue();


            if(xLoc == null){
                return false;
            }
            float x = event.getX();
            float y = event.getY();

            int boundaryX = characterCircle.getmRadius() / 13; 
            int boundaryY = characterCircle.getmRadius() / 13;

I have tried getRowX() and getRowY() , but they don't work in my case. because I don't want to have position related to the screen..

Please help me in this issue.

Many thanks

mary
  • 369
  • 1
  • 5
  • 16

1 Answers1

2

TalkBack captures touch events and translates them to other AccessibilityEvents, which can be implemented by the backend in a number of ways depending on the version of the operating system. In none of these should you be depending on the location of click/double click/any touch event. It may be deterministic, but not in any way that matters. You can pass through touch gestures to a certain extent, but only for longer touch related events, like swipes. In particular, any aspects of controls that depend on custom Touch Listeners, is likely to be completely broken with ATs that capture touch interaction.

MobA11y
  • 18,425
  • 3
  • 49
  • 76
  • Thanks for your response, but I have a page that has a custom view.It is for entering the passcode . I can find the key which user touched by the location of touch event. (This is our functionality)You mean I should change the previous implementation ?How can I find what is the reason for braking of listener. I also tested sending sms when talkback is enabled on that phone,it seems it has the same problem,android can't detect correct key. – mary May 03 '17 at 08:44
  • The reason is you're not gettig real touch events. You're getting accessibility events. They do things like manuall call on click, not simulate hardware touch events. You description of the problem is not concise enough for me to elaborate any more on a potential solution. – MobA11y May 03 '17 at 17:40