2

I am trying to use DDMS hierarchy viewer to capture the virtual view hierarchy (tree structure of the custom view widget). This custom view widget is from android's sample code ApiDemos which has the accessibilityNodeProvider implemented. the thing is when hierarchy viewer and UiAuotmatorViewer do not capture the custom view widget's tree structure. It only shows the whole custom view as a single view object. I would really appreciate any inputs here. Desperately need some helps.

  • Hierarchyviewer doesn't know about virtual views, but UiAutomatorViewer should be able to see them. On what version of Android are you testing? – alanv Sep 19 '14 at 18:03
  • 4.4.2...i tried and it didnt capture the custom view widget's virtual view hierarchy which was added in the accessibilityNodeProvider. – user2646986 Sep 19 '14 at 18:17
  • Which ApiDemos example are you using? The most recent ApiDemos doesn't have a virtual view hierarchy sample -- it was removed in favor of the TouchExplorationHelper sample in SupportV4Demos. – alanv Sep 22 '14 at 22:49
  • it is from android-18. 19, 20, and L dont have it. i was following this http://developer.android.com/guide/topics/ui/accessibility/apps.html to use that example to try it out. any other suggestions? @alanv – user2646986 Sep 24 '14 at 12:51

2 Answers2

0

For old version of android, use .\adt\sdk\tools\hierarchyviewer.bat to get view hierarchy

Harsha Vardhan
  • 3,324
  • 2
  • 17
  • 22
  • it is not about finding a tool to get the view hierarchy..i try a standard andriod widget it works fine, but not on the custom view widget (which has accessbility node provider implemented) and according this link,http://developer.android.com/guide/topics/ui/accessibility/apps.html#custom-views, it should populate the virtual view hierarchy of the custom widget. – user2646986 Sep 19 '14 at 18:21
0

after debugging..and i found out that this is as simple as just adding a single line of codes which is missing in the sample. Add info.setVisibleToUser(true); right before you return the AccessibilityNodeInfo will enable view hierarchy tool to see the tree structure of this custom view.