title: XML parser for dynamic layout (dynamically loaded skins)
body: <p>I want to write an app where (at least for now) the content is always the same but the layout is loaded dynamically at run time based on a user preference. Essentially I want the app to apply a "skin" which may look completely different to other skins.</p>
  
  <p>I found some tutorials using SAXparser:
  <a href="http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser/" rel="nofollow noreferrer">http://www.androidpeople.com/android-xml-parsing-tutorial-using-saxparser/</a>
  <a href="http://twigstechtips.blogspot.com/2010/12/android-how-to-parse-xml-string.html" rel="nofollow noreferrer">http://twigstechtips.blogspot.com/2010/12/android-how-to-parse-xml-string.html</a>
  and can imagine writing something from scratch that recognizes all the standard xml layout tags and then dynamically loads each part of the layout. But that's a lot of work to do from scratch! Surely this functionality is available in android, or surely someone has written some open source code which can be run at the start of your activity's onCreate method, which takes in an xml file and sets your layout?</p>
  
  <p>I found a similar but unsatisfactorily answered question here:
  <a href="https://stackoverflow.com/questions/2576755/how-to-create-a-layout-file-programmatically">How to create a layout file programmatically</a>
  which makes me think that since setContentView must take an integer resourceID as its argument, the fact that these are pre-baked at compile time might be a problem. (setContentView may also take a View object as its argument, but I don't want a ton of if statements and to pass it each View object one by one, I want some code that inputs an xml file or xml string and sets the content view.) </p>
  
  <p>Maybe I'm way off track. Is there another way to do this? I would think that the ability to have an app with dynamically loaded skins is important.</p>
  
  <p>Thanks!</p>