Whats the best way for me to take an android XML layout file and automatically generate the equivalent Java code? Does a tool like JAXB work and if so how do I use it?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Step #1: Parse the XML.
Step #2: Generate the Java code. You’ll have to pray that you can build your own
AttributeSetimplementation that works with your generated code, otherwise this will be a very complex problem.AFAIK, JAXB needs an XML Schema, and there is no such schema possible for the Android layout file.
Whatever problem you’re trying to solve this way, there’s probably a better solution.
I seriously doubt that this will be “simple” for any reasonable definition of the term.