NativeUI - getters and setters

Hi Everyone,

While looking through the Pulse app today, we’ve noticed that there are quite a few places where the following kind of things are happening:

nUITextfieldElement text = new nUITextfieldElement(NUIID_SOME_TEXT, “Hello, World!”);
text.text_color = 0xFF888888;

nUIImageElement image = new nUIImageElement(…);
image.align = nUIConstants.right;

Please note that you should not be accessing variables like text_color and align directly. Instead, use the getters and setters, like this:

nUITextfieldElement text = new nUITextfieldElement(NUIID_SOME_TEXT, “Hello, World!”);
text.setTextColor(0xFF888888 );

nUIImageElement image = new nUIImageElement(…);
image.setAlign(nUIConstants.right);

While using the variables directly can work under Phoney, it’s very likely to cause you problems on other platforms. The getters and setters provided often do extra work to bring NativeUI constants over to native values, set update flags, etc.

It is also very likely that these kind of variables will not remain publicly visible in the Java library going forward.

Regards,
Mark.