Mobile Phone Handheld Hardware Hardware Rick Rogers John Lombardo O'Reilly Media, Inc. O'Reilly Media Android Application Development, 1st EditionChapter 4. Under the Covers: Startup Code and Resources in the MJAndroid
ApplicationChapter 3 introduced the
major application we use in this book to illustrate basic Android concepts.
That chapter explained which files make up the source code, but it didn't
actually cover any source code in the application. We'll start looking at
source code in this chapter. And to allow you to get started developing an
application quickly, we'll begin with the first task every standalone
application has to perform: initialization. The events covered in this chapter occur between your selecting "Run
As Android Application" from the Eclipse menu and seeing the map that
MJAndroid displays at startup. This chapter shows how Android makes it easy
to create relatively complex applications. In just 80 lines of code and some
associated XML resource files, MJAndroid manages to: Display an interactive map Track the current location of the Android phone and update the
map Create a local database of information and load user preferences
into it Provide a dynamically changing menu Display user interface elements such as labels, buttons, and
spinners Run a new Activity to display a supporting screen
The Java code in an Android application interacts tightly with XML resource files, so we'll bounce back and
forth between them in this chapter. As we point out repeatedly, XML files
are easier to tweak during development and maintain over the life of an
application. The design of Android encourages you to specify the look and
behavior of the application in the resource files.
|
|
|
|
|