Skip to content Skip to sidebar Skip to footer

Android Talkback Reading Phone Numbers In Webview Incorrectly

I'm having a minor headache with the TalkBack screen reader service when reading phone numbers in a WebView, and I can't seem to find a solution. This is a snippet of some html co

Solution 1:

For this element, android:contentDescription="One eight hundred quit now"

Solution 2:

Use the following Accessibility Deligate for your editText or textView

@Override
public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
    super.onInitializeAccessibilityNodeInfo(host, info);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {

        switch (host.getId()) {
            case R.id.tv_bookingID:
                if (((TextView) host).getText().length() > 1) {
                    sb.delete(0, sb.length());
                    for (char c : ((TextView) host).getText().toString().toCharArray()) {
                        sb.append(c).append(" ");
                    }
                    //change text for talkback
                    info.setText(null);
                    info.setContentDescription(sb.toString().trim());

                }
                break;
        }//switch
    }//if
}

Post a Comment for "Android Talkback Reading Phone Numbers In Webview Incorrectly"