@Override public String dumpWindowHierarchy(boolean compressed){
  device.setCompressedLayoutHeirarchy(compressed);
  try {
    ByteArrayOutputStream os=new ByteArrayOutputStream();
    device.dumpWindowHierarchy(os);
    os.close();
    return os.toString("UTF-8");
  }
 catch (  FileNotFoundException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
 finally {
    device.setCompressedLayoutHeirarchy(false);
  }
  return null;
}

@ Override public String dumpWindowHierarchy ( boolean compressed ) { device . setCompressedLayoutHeirarchy ( compressed ) ; try { ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; device . dumpWindowHierarchy ( os ) ; os . close ( ) ; return os . toString ( "UTF-8" ) ; } catch ( FileNotFoundException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } finally { device . setCompressedLayoutHeirarchy ( false ) ; } return null ; }
helper method used for debugging to dump the current window ' s layout hierarchy .
