knowcode-xml icon indicating copy to clipboard operation
knowcode-xml copied to clipboard

Generate a resources class like the R used on Android

Open flsobral opened this issue 5 years ago • 0 comments

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.

flsobral avatar Jul 10 '20 20:07 flsobral