发布时间: 2012-08-08 14:32:45 作者: rapoo
从源码中Activity 的定义来理解 Activity
首先我们来看下源码中源于Activity的定义:
Context是一个抽象类,因此可以知道Activity其实就是一个Context,并实现了一些接口,如何理解Context呢?
Context 俗称上下文,在很多对象定义中我们都用到了Context,例如ImageViewimageView = new ImageView(this); 这里的this就是当前Activity所在的Context,源码中对Context的解释如下:
Interface to global information about anapplication environment. This is an abstract class whose implementation isprovided by the Android system. It allows access to application-specificresources and classes, as well as up-calls for application-level operationssuch as launching activities, broadcasting and receiving intents, etc.
Context只是一个接口,真正实现Context功能的是ContexImpl类,为了了解Context具体有什么作用,我们先来了解下Context中定义了哪些接口:
20款移动开发框架平台介绍
微信公众平台如何保证access_token长期
中国城市列表相仿手机通讯录显示方式
Socket连接与HTTP联接
平添wifi定位功能
偷空写了两个游戏
java集合类 - 实现 细节
hidden visible display 的差别
春节前最后一个:立地群飞
64位 与32 位 差异