Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <accessibility-service
  2. android:description="@string/accessibility_service_description"
  3. android:accessibilityEventTypes="typeViewClicked|typeViewFocused|typeWindowStateChanged"
  4. android:accessibilityFeedbackType="feedbackGeneric"
  5. android:notificationTimeout="100"
  6. android:canRetrieveWindowContent="true"
  7. xmlns:android="http://schemas.android.com/apk/res/android" />
  8.  
  9. @Override
  10. public void onAccessibilityEvent(AccessibilityEvent event) {
  11. final int eventType = event.getEventType();
  12. String eventText = null;
  13. switch(eventType) {
  14. case AccessibilityEvent.TYPE_VIEW_CLICKED:
  15. eventText = "Focused: ";
  16. break;
  17. case AccessibilityEvent.TYPE_VIEW_FOCUSED:
  18. eventText = "Focused: ";
  19. break;
  20. }
  21.  
  22. eventText = eventText + event.getContentDescription();
  23.  
  24. // Do something nifty with this text, like speak the composed string
  25. // back to the user.
  26. speakToUser(eventText);
  27. ...
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement