android - print a view hierarchy on a device -
debugging app strange results on samsung phones, don't have physical access to. i'd ask user run instrumented app debug. app gets view has unknown (to me ;-) hierarchy in (viewgroups etc). there way "walk" view , print out string / ddms components in view (etc viewgroups in etc)?
this akin hierarchyviewer tool - if had adb level access device.
update: guess use method
void dumpviewhierarchywithproperties(context context, viewgroup group, bufferedwriter out, int level) from viewdebug.java android os sources ...
anyone have better idea?
thanks!
here's utility function made purpose:
public static void printviewhierarchy(viewgroup vg, string prefix) { (int = 0; < vg.getchildcount(); i++) { view v = vg.getchildat(i); string desc = prefix + " | " + "[" + + "/" + (vg.getchildcount()-1) + "] "+ v.getclass().getsimplename() + " " + v.getid(); log.v("x", desc); if (v instanceof viewgroup) { printviewhierarchy((viewgroup)v, desc); } } }
Comments
Post a Comment