Java Reference
In-Depth Information
typewhencomparingtheintentagainstanintentfilter.Itdoesn'ttakeextrasandflags
into consideration.
Activities
Anactivityisacomponentthatpresentsauserinterfacesothattheusercaninteractwith
the app. For example, Android's Contacts app includes an activity for entering a new
contact,itsPhoneappincludesanactivityfordialingaphonenumber,anditsCalculator
app includes an activity for performing basic calculations (see Figure 12-2 ) .
Figure 12-2. The main activity of Android's Calculator app lets the user perform basic calcula-
tions.
Although an app can include a single activity, it's more typical for apps to include
multipleactivities.Forexample,Calculatoralsoincludesan“advancedpanel”activity
that lets the user calculate square roots, perform trigonometry, and carry out other ad-
vanced mathematical operations.
Note Because activities are the most frequently used component, I discuss them
in more detail than broadcast receivers, content providers, and services. Check out
Android Recipes for detailed coverage of these other component categories.
Activities are described by subclasses of the android.app.Activity class,
which is an indirect subclass of the abstract android.content.Context class.
Note Context isanabstractclasswhosemethodsletappsaccessglobalinforma-
tionabouttheirenvironments(e.g.,theirapplicationresources),andallowappstoper-
formcontextualoperations,suchaslaunchingactivitiesandservices,broadcastingin-
tents, and opening private files.
Search WWH ::




Custom Search