Java Reference
In-Depth Information
Check out the “Tasks and Back Stack” section in Google's online Android doc-
umentation to learn more about activities and tasks: ht-
tp://developer.android.com/guide/topics/fundamentals/
tasks-and-back-stack.html .
Broadcast Receivers
Abroadcastreceiverisacomponentthatreceivesandreactstobroadcasts.Manybroad-
casts originate in system code; for example, an announcement that the timezone has
been changed or the battery power is low.
Apps can also initiate broadcasts. For example, an app may want to let other apps
know that some data has finished downloading from the network to the device and is
now available for them to use.
Note The abstract android.content.BroadcastReceiver class imple-
ments broadcast receivers.
Content Providers
Acontentproviderisacomponentthatmakesaspecificsetofanapp'sdataavailableto
otherapps.ThedatacanbestoredintheAndroidfilesystem,inanSQLitedatabase,or
in any other manner that makes sense.
Contentprovidersarepreferabletodirectlyaccessingrawdatabecausetheydecouple
componentcodefromrawdataformats.Thisdecouplingpreventscodebreakagewhen
formats change.
Note The abstract android.content.ContentProvider class implements
content providers.
Services
A service is a component that runs in the background for an indefinite period of time,
and which doesn't provide a user interface. As with an activity, a service runs on the
process'smainthread;itmustspawnanotherthreadtoperformatime-consumingoper-
ation. Services are classified as local or remote:
• A local service runs in the same process as the rest of the app. Such services
make it easy to implement background tasks.
• A remote service runsinaseparateprocess.Suchservicesletyouperformin-
terprocess communication.
Search WWH ::




Custom Search