�� Activities: The building block of the user interface is the activity. You
can think of an activity as being the Android analogue for the window
or dialog box in a desktop application. While it is possible for activities
to not have a user interface, most likely your “headless” code will be
packaged in the form of content providers or services.
�� Content providers: Content providers provide a level of abstraction for
any data stored on the device that is accessible by multiple
applications. The Android development model encourages you to
make your own data available to other applications, as well as your
own. Building a content provider lets you do that, while maintaining
complete control over how your data is accessed.
�� Services: Activities and content providers are short-lived and can be
shut down at any time. Services, on the other hand, are designed to
keep running, if needed, independent of any activity. You might use a
service for checking for updates to an RSS feed or to play back music
even if the controlling activity is no longer operating.
�� Intents: Intents are system messages, running around the inside of the
device, notifying applications of various events, from hardware state
changes (e.g., an SD card was inserted), to incoming data (e.g., an
SMS message arrived), to application events (e.g., your activity was
launched from the device’s main menu). Not only can you respond to
intents, but you can create your own to launch other activities or to let
you know when specific situations arise (e.g., raise such-and-so intent
when the user gets within 100 meters of this-and-such location).
0 comments:
Post a Comment