knowcode-xml
knowcode-xml copied to clipboard
Generate a resources class like the R used on Android
The idea is to make it easier to reference resources and controls from the code, by generating a class with direct reference to them.
For example, instead of:
Button plus = (Button) xmlCont.getControlByID("@+id/plus");
plus.addPressListener(new PressListener() {
...
something like:
R.controls.plus.addPressListener(new PressListener() {
...
The main objective isn't simply reducing loc, but to reduce the chance of error during development, with less typecasts and referencing controls using strings.