get All Accessibility Services - Android User Interface

Android examples for User Interface:AccessibilityEvent

Description

get All Accessibility Services

Demo Code


//package com.java2s;
import java.util.ArrayList;
import android.content.Context;
import android.provider.Settings;
import android.text.TextUtils;

public class Main {
    public static ArrayList<String> getAllAccessibilityServices(
            Context context) {/*from   w  ww .j a  v  a  2s. c o  m*/
        TextUtils.SimpleStringSplitter colonSplitter = new TextUtils.SimpleStringSplitter(
                ':');
        ArrayList<String> allAccessibilityServices = new ArrayList<String>();

        String settingValue = Settings.Secure.getString(context
                .getApplicationContext().getContentResolver(),
                Settings.Secure.ENABLED_ACCESSIBILITY_SERVICES);

        if (settingValue != null) {
            colonSplitter.setString(settingValue);
            while (colonSplitter.hasNext()) {
                String accessabilityService = colonSplitter.next();
                allAccessibilityServices.add(accessabilityService);
            }
        }
        return allAccessibilityServices;
    }
}

Related Tutorials