It depends on what your aim is. If you want to make instances of
subclasses of views and layouts, you can do that my naming them in
layout files.

If you want something more general purpose, try JAXB.

Or you can roll your own with the XML parser in Android, and
reflection.

On Jun 3, 11:09 am, drozzy <dro...@gmail.com> wrote:
> Hey guys,
> I would really like to achieve what Android is currently doing for
> it's resources: auto-generating class with member variables from the
> xml (or json) files.
>
> I would like to have an text or xml file of items, with ids, names,
> values and would like to generate Java code from it (in Eclipse).
> So if my json (or xml) file is something like:
>
> parts = [
>     { 'partA' : { 'id' : 2342,  'name' : 'Part A'} },
>     { 'partB' : {'id' : 53, 'name' : 'Part Beee'} },
>
>     etc....
> ]
>
> Then I can refer to my helper class:
>
>    Parts.ids.partA  // is an int of value 2342
>    Parts.names.partA  // is a String "Part A"
>
> and I would like this file to regenerate automatically every time I
> change the xml file
>
> Is that what Android plugin for eclipse is for - or is this just part
> of eclipse build process? Any help is appreciated.
>
> I've also asked this question on stackoverflow but getting little
> traction there with only 2 
> answers:http://stackoverflow.com/questions/2960122/generate-java-code-in-eclipse

-- 
You received this message because you are subscribed to the Google
Groups "Android Beginners" group.

NEW! Try asking and tagging your question on Stack Overflow at
http://stackoverflow.com/questions/tagged/android

To unsubscribe from this group, send email to
android-beginners+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to