When Android was being invented, its designers faced many choices whose outcome would determine the success or failure of their project. Once they had rejected all the other smartphone operating systems, both closed and open source, and decided to build their own atop the Linux kernel, they were faced with somewhat of a blank canvas. One important choice was which user interface technology to deploy: JavaME, Swing, SWT, or none of the above.
JavaME is the Java Micro Edition, Sun/Oracle's official standard API for cell phones and other small devices. JavaME is actually a pretty big success story: tens or hundreds of millions of cell phones have a Java Micro Edition runtime inside. And every Blackberry made since around 2000, and all Blackberry applications in the world, are based on JavaME. But the JavaME GUI was regarded as too limiting, having been designed for the days when cell phones had really tiny screens.
Swing is the Java Standard Edition ("Desktop Java", JavaSE, a.k.a. JDK or JRE) GUI. It is based atop the earlier AWT. It can make some beautiful GUI music in the right hands, but is just too large and uses too much overhead for Android.
SWT is the GUI layer developed for use in the Eclipse IDE itself and in Eclipse Rich Clients. It is an abstraction layer, and depends on the underlying operating-specific toolkit (e.g., Win32 in the Microsoft arena, GTK under Unix/Linux, etc.).
The final option, and the one ultimately chosen, was to go it alone. The Android designers thus built their own Graphical User Interface toolkit designed specifically for smartphones. But they took many good ideas from the other toolkits, and learned from the mistakes that had been made along the way.
To learn any new GUI framework is, necessarily, a lot of work. Making your apps work well in the community of apps for that UI is even more work. Recognizing this, Google have set up the Android Design Site, mainly aimed at Android 4 (Ice Cream Sandwich). Another set of guidelines that can help is the Android Patterns site, which is not about coding but about showing designers how the Android visual experience is supposed to work, Illustrated, crowd-sourced, and recommended!
This chapter covers the main GUI elements in Android. Two following chapters cover the all-important ListView component and the "things that go bump in your device": Menus, Dialogs, Toasts and Notifications.