• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<script type="text/javascript" src="http://www.corp.google.com/style/prettify.js"></script>
4<script src="http://www.corp.google.com/eng/techpubs/include/navbar.js" type="text/javascript"></script>
5</head>
6
7<body>
8
9<p>High-level classes encapsulating the overall Android application model.
10The central class is {@link android.app.Activity}, with other top-level
11application components being defined by {@link android.app.Service} and,
12from the {@link android.content} package, {@link android.content.BroadcastReceiver}
13and {@link android.content.ContentProvider}.  It also includes application
14tools, such as dialogs and notifications.</p>
15
16<p>This package builds on top of the lower-level Android packages
17{@link android.widget}, {@link android.view}, {@link android.content},
18{@link android.text}, {@link android.graphics}, {@link android.os}, and
19{@link android.util}.</p>
20
21<p>An {@link android.app.Activity Activity} is a specific operation the
22user can perform, generally corresponding
23to one screen in the user interface.
24It is the basic building block of an Android application.
25Examples of activities are "view the
26list of people," "view the details of a person," "edit information about
27a person," "view an image," etc.  Switching from one activity to another
28generally implies adding a new entry on the navigation history; that is,
29going "back" means moving to the previous activity you were doing.</p>
30
31<p>A set of related activities can be grouped together as a "task".  Until
32a new task is explicitly specified, all activites you start are considered
33to be part of the current task.  While the only way to navigate between
34individual activities is by going "back" in the history stack, the group
35of activities in a task can be moved in relation to other tasks: for example
36to the front or the back of the history stack.  This mechanism can be used
37to present to the user a list of things they have been doing, moving
38between them without disrupting previous work.
39</p>
40
41<p>A complete "application" is a set of activities that allow the user to do a
42cohesive group of operations -- such as working with contacts, working with a
43calendar, messaging, etc.  Though there can be a custom application object
44associated with a set of activities, in many cases this is not needed --
45each activity provides a particular path into one of the various kinds of
46functionality inside of the application, serving as its on self-contained
47"mini application".
48</p>
49
50<p>This approach allows an application to be broken into pieces, which
51can be reused and replaced in a variety of ways.  Consider, for example,
52a "camera application."  There are a number of things this application
53must do, each of which is provided by a separate activity: take a picture
54(creating a new image), browse through the existing images, display a
55specific image, etc.  If the "contacts application" then wants to let the
56user associate an image with a person, it can simply launch the existing
57"take a picture" or "select an image" activity that is part of the camera
58application and attach the picture it gets back.
59</p>
60
61<p>Note that there is no hard relationship between tasks the user sees and
62applications the developer writes.  A task can be composed of activities from
63multiple applications (such as the contact application using an activity in
64the camera application to get a picture for a person), and multiple active
65tasks may be running for the same application (such as editing e-mail messages
66to two different people).  The way tasks are organized is purely a UI policy
67decided by the system; for example, typically a new task is started when the
68user goes to the application launcher and selects an application.
69</p>
70
71</body>
72</html>
73