private ParsedViewDetail deflate(View view){
  ByteArrayOutputStream os=new ByteArrayOutputStream();
  try {
    mViewHierarchy.deflate(view,os);
    DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder=factory.newDocumentBuilder();
    Document doc=documentBuilder.parse(new ByteArrayInputStream(os.toByteArray()));
    Element root=(Element)doc.getFirstChild();
    return convertToNode(root);
  }
 catch (  SAXException e) {
    throw new RuntimeException(e);
  }
catch (  ParserConfigurationException e) {
    throw new RuntimeException(e);
  }
catch (  IOException e) {
    throw new RuntimeException(e);
  }
}

private ParsedViewDetail deflate ( View view ) { ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; try { mViewHierarchy . deflate ( view , os ) ; DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder documentBuilder = factory . newDocumentBuilder ( ) ; Document doc = documentBuilder . parse ( new ByteArrayInputStream ( os . toByteArray ( ) ) ) ; Element root = ( Element ) doc . getFirstChild ( ) ; return convertToNode ( root ) ; } catch ( SAXException e ) { throw new RuntimeException ( e ) ; } catch ( ParserConfigurationException e ) { throw new RuntimeException ( e ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } }
deflates a view into an xml . just to be clear though , this is only for debugging and it won ' t look anything like a real android layout file .
