在各个Activity传递值的时候比较麻烦,当Activity较多的时候,传值特别麻烦。
用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, 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. If your singleton needs a global context (for example to register broadcast receivers), the function to retrieve it can be given a Context which internally usesContext.getApplicationContext() when first constructing the singleton.
大概是 提供 应用的全局状态。 在AndroidManifest中设置后可以提供自己的实现(例如注册broadcast receiver)。通过单例的getApplicationContext可以得到Context对象。