androidaccessibility

Android - How to read Accessibility for touch listener


I am using a touch listener for Android. When I activate accessibility in Android it reads like "Double tap to Activate." But When I double tap action is not working. Instead Action works when I touch with double finger in that view.

How to change the accessibility message? I want to read like "Touch with double finger to activate".

ed_text = findViewById(R.id.ed_text);
        ed_text.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {

                if (event.getAction() == MotionEvent.ACTION_DOWN) {

                    Toast.makeText(MainActivity.this,"ACTION_DOWN", Toast.LENGTH_LONG).show();

                } else if (event.getAction() == MotionEvent.ACTION_UP) {

                    Toast.makeText(MainActivity.this,"ACTION_UP", Toast.LENGTH_LONG).show();

                } else if (event.getAction() == MotionEvent.ACTION_CANCEL) {

                    Toast.makeText(MainActivity.this,"ACTION_CANCEL", Toast.LENGTH_LONG).show();
                }

                return false;
            }
        });

Solution

  • @Vijayadhas Chandrasekaran You should use OnClickListener instead or override performAccessibilityAction for your view in your custom view class,or via setAccessibilityDelegate.