[Android]Android中的Application类
Class Overview:
Base class for those who need to maintain global application state. You can provide your own implementation by specifying its name in your AndroidManifest.xml's <application> tag, which will cause that class to be instantiated for you when the process for your application/package is created.
SDK中的描述:Application类是为了那些需要保存全局变量设计的基本类,你可以在AndroidManifest.xml的<application>标签中进行自己的实现,这样的结果是:当你的application或者包被建立的时候将引起那个类被建立。
理解:就是说application是用来保存全局变量的,并且是在package创建的时候就跟着存在了。所以当我们需要创建全局变量的时候,不需 要再像 j2se那样需要创建public权限的static变量,而直接在application中去实现。只需要调用Context的 getApplicationContext或者Activity的getApplication方法来获得一个application对象,再做出相应 的处理。(引自huangbz321)
相关推荐
luoj 2011-09-12
androidstudyroom 2011-08-19
TTHHVV 2011-12-05
peixiaopao 2012-05-06
ruanjianxiong 2012-05-23
fanjunjian 2015-03-03
Nostalgiachild 2014-11-02
oLimxing 2014-07-21
Jemy杰 2013-04-26
redbricks 2013-01-18
mlsnatalie 2012-10-21
家猫OR野猫 2012-05-11
crazymaple 2012-03-23
xiaozhifree 2012-02-27
西木 2012-01-03
xfcyhades 2011-10-07
rookieding 2011-09-10
dianlunhui 2011-06-13
wangkuifeng0 2011-05-26