anvil-ui/anvil

Xml views are recreated on every view() call.

Closed this issue · 1 comments

dant3 commented

If you'll try an example from README, you can quickly notice this. The problematic bits seems to be around Anvil.java(289):

                } else if (c == null && (v == null || get(v, "_layoutId") != Integer.valueOf(layoutId))) {

Here _layoutId property from view is an Object and is compared by reference with boxed Integer returned by Integer.valueOf(). Since Integer.valueOf() always returns new object, it will always destroy inflated xml view, and create a new one.

dant3 commented

Ok, I see you already addressed it in master branch. Too bad you have boxing all over the place tho.