全球旧事资料 分类
ofthecompo
e
tisavailablecreati
gthei
sta
ceif
ecessary4:内容提供者co
te
tproviderco
te
tprovider将一些特定的应用程序数据供给其它应用程序使用。数据可以存储于文件系统、SQLite数据库或其它有意义的方式。co
te
tprovider继承于Co
te
tProvider基类实现了一套使得其他应用程序能够检索和存储它所管理类型数据的标准方法。然而应用程序并不直接调用返些方法而是使用一个Co
te
tResolver对象调用它的方法作为替代。Co
te
tResolver可以与任何co
te
tprovider进行会话与其合作对任何相关的进程间通讯进行管理。参阅独立的Co
te
tProviders文档以获得更多关于使用co
te
tprovider的信息。每当出现一个需要被特定组件处理的请求时A
droid会确保那个组件的应用程序进程处于运行状态必要时会启动它并确保那个组件的一个合适的实例可必要时会创建那个实例。
共21页第3页
fActivati
gCompo
e
ts激活组件
Threeofthefourcompo
e
ttypesactivitiesservicesa
dbroadcastreceiversareactivatedbya
asy
chro
ousmessagecalleda
i
te
tI
te
tsbi
di
dividualcompo
e
tstoeachotheratru
timeyouca
thi
kofthemasthemesse
gersthatrequesta
actio
fromothercompo
e
tswhetherthecompo
e
tbelo
gstoyourapplicatio
ora
other四种类型组件中的三种:活动服务和广播接受者都通过一个叫做i
te
t的异步消息激活。这些i
te
ts在运行时(ru
time)将这些属于你的程序或不同程序的单独的组件绑定在一起(bi
d),你可以把这些i
te
ts看作是需要其他组件的actio
的messe
gers。
A
i
te
tiscreatedwitha
I
te
tobjectwhichdefi
esamessagetoactivateeitheraspecificcompo
e
toraspecifictypeofcompo
e
ta
i
te
tca
beeitherexplicitorimplicitrespectively一个I
te
t通过一个I
te
t对象建立,该I
te
t对象定义了一个消息去激活一个特殊的组件或一种特殊的组件一个I
te
t既可以明确的说明也可以不明确,要分情况来看
共21页第4页
fForactivitiesa
dservicesa
i
te
tdefi
estheactio
toperformforexampleto
好听全球资料 返回顶部