Android 四大组件之Activity篇01之 概述

本章介绍会对Android的四大组建(Activity、Service、BroadcastReceiver、ContentProvider)中的Activity作概括性的介绍。

首先,了解一下"什么是Activity",Android中Activity的介绍如下:

An activity is a single, focused thing that the user can do. Almost all activities interact with the user, so the Activity class takes care of creating a window for you in which you can place your UI with setContentView(). While activities are often presented to the user as full-screen windows, they can also be used in other ways: as floating windows (via a theme with windowIsFloating) or embedded inside of another activity (using ActivityGroup).

从中,可以看出: Activity 是用户接口程序,原则上它会提供给用户一个交互式的接口功能。它是 android 应用程序的基本功能单元。Activity 本身是没有界面的。所以activity类创建了一个窗口,开发人员可以通过setContentView(View)接口把UI放到activity创建的窗口上,当activity指向全屏窗口时,也可以用其他方式实现:作为漂浮窗口(通过windowIsFloating的主题集合),或者嵌入到其他的activity(使用ActivityGroup)。activity是单独的,用于处理用户操作。几乎所有的activity都要和用户打交道

接下来,我们将围绕Activity,依次介绍:
(1) Activity的生命周期
(2) Activity的启动方式和获取结果
(3) Activity的启动模式
(4) Activity和Application、进程之间的关系

by skywang
Previous     Next