Android GUI Architecture
The Android UI framework is, like the other UI frameworks, organized around the common Model-View-Controller pattern illustrated in Figure. It provides structure and tools for building a Controller that handles user input (like key presses and screen taps) and a View that renders graphical information to the screen.
The Model
The Model is the guts of your application: what it actually does. It might be, for instance, the database of tunes on your device and the code for playing them. It might be your list of contacts and the code that places phone calls or sends IMs to them.
While
a particular application’s View and Controller will necessarily reflect
the Model they manipulate, a single Model might be used by several
different applications. Think, for instance, of an MP3 player and an
application that converts MP3 files into WAV files. For both
applications, the Model includes the MP3 file format and codecs for
it. The former application, however, has the familiar Stop, Start, and
Pause controls, and plays the track. The latter may not produce any
sound at all; instead, it will have controls for setting bitrate, etc.
The Model is all about the data.
The View
The
View is the application’s feedback to the user. It is the portion of
the application responsible for rendering the display, sending audio to
speakers, generating tactile feedback, and so on. The graphical portion
of the Android UI framework’s View, is implemented as a tree of
subclasses of the View class. Graphically, each of these objects
represents a rectangular area on the screen that is completely within
the rectangular area represented by its parent in the tree. The root of
this tree is the application window.
The Controller
The
Controller is the portion of an application that responds to external
actions: a keystroke, a screen tap, an incoming call, etc. It is
implemented as an event queue. Each external action is represented as a
unique event in the queue. The framework removes each event from the
queue in order and dispatches it.
No comments:
Post a Comment