samples/Support4Demos/src/main/java/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java
private void updateAccessibilityStateView() {
        List<AccessibilityServiceInfo> enabledServices =
                mAccessibilityManager.getEnabledAccessibilityServiceList(
                        AccessibilityServiceInfo.FEEDBACK_SPOKEN);
        if (!enabledServices.isEmpty()) {
            StringBuilder builder = new StringBuilder();
            final int enabledServiceCount = enabledServices.size();
            for (int i = 0; i < enabledServiceCount; i++) {
                AccessibilityServiceInfo service = enabledServices.get(i);
                // Some new APIs were added in ICS for getting more information about
                // an accessibility service. Again accessed them via the support library.
                ResolveInfo resolveInfo = service.getResolveInfo();
                String serviceDescription = getString(
                        R.string.accessibility_manager_enabled_service,
                        resolveInfo.loadLabel(getPackageManager()),
                        AccessibilityServiceInfoCompat.feedbackTypeToString(service.feedbackType),
                        AccessibilityServiceInfoCompat.loadDescription(
                                service, getPackageManager()),
                        service.getSettingsActivityName());
                builder.append(serviceDescription);
            }
            mAccessibilityStateView.setText(builder);
        } else {
            // Either no services or the platform API version is not high enough.
            mAccessibilityStateView.setText(getString(
                    R.string.accessibility_manager_no_enabled_services));
        }
    }
/**
     * Updates the content of a TextView with description of the enabled
     * accessibility services.
     */
Updates the content of a TextView with description of the enabled
accessibility services.
Updates the content of a TextView with description of the enabled accessibility services .
private void updateAccessibilityStateView() {
        List<AccessibilityServiceInfo> enabledServices =
                mAccessibilityManager.getEnabledAccessibilityServiceList(
                        AccessibilityServiceInfo.FEEDBACK_SPOKEN);
        if (!enabledServices.isEmpty()) {
            StringBuilder builder = new StringBuilder();
            final int enabledServiceCount = enabledServices.size();
            for (int i = 0; i < enabledServiceCount; i++) {
                AccessibilityServiceInfo service = enabledServices.get(i);
                ResolveInfo resolveInfo = service.getResolveInfo();
                String serviceDescription = getString(
                        R.string.accessibility_manager_enabled_service,
                        resolveInfo.loadLabel(getPackageManager()),
                        AccessibilityServiceInfoCompat.feedbackTypeToString(service.feedbackType),
                        AccessibilityServiceInfoCompat.loadDescription(
                                service, getPackageManager()),
                        service.getSettingsActivityName());
                builder.append(serviceDescription);
            }
            mAccessibilityStateView.setText(builder);
        } else {
            mAccessibilityStateView.setText(getString(
                    R.string.accessibility_manager_no_enabled_services));
        }
    }
private void updateAccessibilityStateView ( ) { List < AccessibilityServiceInfo > enabledServices = mAccessibilityManager . getEnabledAccessibilityServiceList ( AccessibilityServiceInfo . FEEDBACK_SPOKEN ) ; if ( ! enabledServices . isEmpty ( ) ) { StringBuilder builder = new StringBuilder ( ) ; final int enabledServiceCount = enabledServices . size ( ) ; for ( int i = 0 ; i < enabledServiceCount ; i ++ ) { AccessibilityServiceInfo service = enabledServices . get ( i ) ; ResolveInfo resolveInfo = service . getResolveInfo ( ) ; String serviceDescription = getString ( R . string . accessibility_manager_enabled_service , resolveInfo . loadLabel ( getPackageManager ( ) ) , AccessibilityServiceInfoCompat . feedbackTypeToString ( service . feedbackType ) , AccessibilityServiceInfoCompat . loadDescription ( service , getPackageManager ( ) ) , service . getSettingsActivityName ( ) ) ; builder . append ( serviceDescription ) ; } mAccessibilityStateView . setText ( builder ) ; } else { mAccessibilityStateView . setText ( getString ( R . string . accessibility_manager_no_enabled_services ) ) ; } }
Updates the content of a TextView with description of the enabled
 accessibility services.
Updates the content of a TextView with description of the enabled accessibility services .
// Some new APIs were added in ICS for getting more information about // an accessibility service. Again accessed them via the support library. // Either no services or the platform API version is not high enough.