Application类注释

来源:互联网 发布:电脑无网络连接怎么办 编辑:程序博客网 时间:2024/05/16 18:35
Application


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, 
你可以提供你自己的实现,在配置文件中用<application>标签来指定
which will cause that class to be instantiated for you when the process for your application/package is created. 
当程序进程创建的时候可以这个类被初始化
There is normally no need to subclass Application. In most situation, static singletons can provide the same functionality in a more modular way. 
通常不需要application的子类。大多数情况,在更多模块方式中静态单例可以提供相同的功能
If your singleton needs a global context (for example to register broadcast receivers),
当你的单例需要全局context时 
the function to retrieve it can be given a android.content.
这个函数需要传入android.content
Context which internally uses Context.getApplicationContext() when first constructing the singleton.
当第一次构造时内部使用Context.getApplicationContext()获得
0 0
原创粉丝点击