Components
一个android程序中可以包含一个多个Components
- Activities:有用户界面的程序;
- Services:后台运行的程序;
- Content providers:提供数据操作,其他components通过 ContentResolver层对content provider进行数据操作;
- Broadcast receivers:接收系统级别程序广播,没有用户界面,可在在提示栏创建显示信息,经常是激活activity和service的入口;
Intent
用来激活除content provider之外的components,components之间的传递信息,可指定激活某个特定component,也可通过intent-filter指定可激活的components类别。
Manifest
描述.apk程序包的信息
- 申明所含components:所有的components包含在<application></application>中,activity用<activity></activity>申明,service用<service></service>申明;
- 申明components的能力:在activity中采用<intent-filter></intent-filter>描述所能接受的intent,包含action和category,action=android.intent.action.MAIN表明该activity为apk程序入口,category = android.intent.category.LAUNCHER表明该activity需在程序启动器中显示,以让用户可以启动该activity;
- 申明程序所需的环境:包含程序所需的屏幕、输入设置、硬件设备和平台版本信息。