首页 > 移动平台 > 详细

Application

时间:2017-04-02 12:41:23      阅读:263      评论:0      收藏:0      [点我收藏+]

Base class for maintaining global application state. You can provide your own implementation by creating a subclass and specifying the fully-qualified name of this subclass as the "android:name" attribute in your AndroidManifest.xml‘s <application> tag. The Application class, or your subclass of the Application class, is instantiated before any other class when the process for your application/package is created.

用来维护全局应用状态的基类,你可以通过创建子类并在AndroidManifest.xml的<application>标签下的 "android:name" 属性指定全限定类名来提供你自己的实现。Application类或者你自己创建的Application的子类,会在你的application/package的进程创建之前的任何类之前实例化。

Note: There is normally no need to subclass Application. In most situations, static singletons can provide the same functionality in a more modular way. If your singleton needs a global context (for example to register broadcast receivers), include Context.getApplicationContext() as a Context argument when invoking your singleton‘s getInstance() method.

注意:通常不太需要实现Application子类。在大多数情况下,静态单例类会更模块化地提供相同的功能。如果你的单例类需要全局的context(例如:要注册broadcast receiver),当调用你单例类的getInstance()方法时,包含Context.getApplicationContext()作为Context。

Application

原文:http://www.cnblogs.com/newjeremy/p/6658627.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!