Programatic UI: How to Build UI
Published April 30th, 2012 Under User Interface | Leave a Comment
UI is typically created by declaring its elements in XML or HTML and hooking them into Java code later. While both XML and declarative style has its followers, it also carries its own bag of problems (such as fragile dependency on String-based bindings, excessive typing of angle brackets known as chevronitis and general inflexibility once the layout gets complicated).
This talk is an introduction to an alternative approach, which is programmatic instantiation of the UI. While this sounds complicated and tedious at first glance, it is not. This is generic technique, that might be used in any Java-based environment (or elsewhere), but the talk will focus on two prominent frameworks : the bulk of the concepts is explained on Android mobile platform, which is a perfect candidate : mobile UI is typically quite simple, but faces the specific set of challenges, and Android is also – by design – very XML centric, so this talk offers a “second string”. Another platform mentioned is Google Widget Toolkit to prove the approach presented in this talk can be applied in various stages.
Presentation offers graceful introduction for beginners, as elevant parts of the Android framework are examined (an anatomy of a ViewGroup), while the bulk of talk disserts how leverage the power Java language to create rich, flexible and attractive UI programatically and do it in effective and comprehensible way. Contrasts to traditional, XML-based approach is highlighted, especially in the problematic areas of the original method. More advanced topics are also touched, such as automatic UI generation by introspecting annotated Java object, but the talk remains within the scope of general, beginners to intermediate Java developers audience.
The presentation is quite short (within 30 minutes limit) and has several examples and demos of actual, working code. In summary : this talk would give you a food for thought if you intuitively feel there is something wrong with the declarative UI and its linking to the Java code, and also prove that Java is great language even for the front-end coding.
Video Producer: Devoxx Conference