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. 10 The central class is {@link android.app.Activity}, with other top-level 11 application components being defined by {@link android.app.Service} and, 12 from the {@link android.content} package, {@link android.content.BroadcastReceiver} 13 and {@link android.content.ContentProvider}. It also includes application 14 tools, 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 22 user can perform, generally corresponding 23 to one screen in the user interface. 24 It is the basic building block of an Android application. 25 Examples of activities are "view the 26 list of people," "view the details of a person," "edit information about 27 a person," "view an image," etc. Switching from one activity to another 28 generally implies adding a new entry on the navigation history; that is, 29 going "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 32 a new task is explicitly specified, all activites you start are considered 33 to be part of the current task. While the only way to navigate between 34 individual activities is by going "back" in the history stack, the group 35 of activities in a task can be moved in relation to other tasks: for example 36 to the front or the back of the history stack. This mechanism can be used 37 to present to the user a list of things they have been doing, moving 38 between 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 42 cohesive group of operations -- such as working with contacts, working with a 43 calendar, messaging, etc. Though there can be a custom application object 44 associated with a set of activities, in many cases this is not needed -- 45 each activity provides a particular path into one of the various kinds of 46 functionality 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 51 can be reused and replaced in a variety of ways. Consider, for example, 52 a "camera application." There are a number of things this application 53 must 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 55 specific image, etc. If the "contacts application" then wants to let the 56 user 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 58 application 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 62 applications the developer writes. A task can be composed of activities from 63 multiple applications (such as the contact application using an activity in 64 the camera application to get a picture for a person), and multiple active 65 tasks may be running for the same application (such as editing e-mail messages 66 to two different people). The way tasks are organized is purely a UI policy 67 decided by the system; for example, typically a new task is started when the 68 user goes to the application launcher and selects an application. 69 </p> 70 71 </body> 72 </html> 73