本文整理汇总了Java中android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat类的典型用法代码示例。如果您正苦于以下问题:Java AccessibilityServiceInfoCompat类的具体用法?Java AccessibilityServiceInfoCompat怎么用?Java AccessibilityServiceInfoCompat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AccessibilityServiceInfoCompat类属于android.support.v4.accessibilityservice包,在下文中一共展示了AccessibilityServiceInfoCompat类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateAccessibilityStateView
import android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat; //导入依赖的package包/类
/**
* Updates the content of a TextView with description of the enabled
* accessibility services.
*/
private void updateAccessibilityStateView() {
// The API for getting the enabled accessibility services based on feedback
// type was added in ICS. Therefore to be backwards compatible we use the
// APIs in the support library. Note that if the platform API version is lower
// and the called API is not available an empty list of services is returned.
List<AccessibilityServiceInfo> enabledServices =
AccessibilityManagerCompat.getEnabledAccessibilityServiceList(mAccessibilityManager,
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 = AccessibilityServiceInfoCompat.getResolveInfo(service);
String serviceDescription = getString(
R.string.accessibility_manager_enabled_service,
resolveInfo.loadLabel(getPackageManager()),
AccessibilityServiceInfoCompat.feedbackTypeToString(service.feedbackType),
AccessibilityServiceInfoCompat.getDescription(service),
AccessibilityServiceInfoCompat.getSettingsActivityName(service));
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));
}
}