Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <accessibility-service
- android:description="@string/accessibility_service_description"
- android:accessibilityEventTypes="typeViewClicked|typeViewFocused|typeWindowStateChanged"
- android:accessibilityFeedbackType="feedbackGeneric"
- android:notificationTimeout="100"
- android:canRetrieveWindowContent="true"
- xmlns:android="http://schemas.android.com/apk/res/android" />
- @Override
- public void onAccessibilityEvent(AccessibilityEvent event) {
- final int eventType = event.getEventType();
- String eventText = null;
- switch(eventType) {
- case AccessibilityEvent.TYPE_VIEW_CLICKED:
- eventText = "Focused: ";
- break;
- case AccessibilityEvent.TYPE_VIEW_FOCUSED:
- eventText = "Focused: ";
- break;
- }
- eventText = eventText + event.getContentDescription();
- // Do something nifty with this text, like speak the composed string
- // back to the user.
- speakToUser(eventText);
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement