Developer Guides

Developer Guides

java Example

if (Build.VERSION.SDK_INT >= 14) {
// If the API version is equal of higher than the version in
// which onInitializeAccessibilityNodeInfo was introduced we
// register a delegate with a customized implementation.
View view = findViewById(R.id.view_id);
view.setAccessibilityDelegate(new AccessibilityDelegate() {
public void onInitializeAccessibilityNodeInfo(View host,
AccessibilityNodeInfo info) {
// Let the default implementation populate the info.
super.onInitializeAccessibilityNodeInfo(host, info);
// Set some other information.
info.setEnabled(host.isEnabled());
}
});
}