getApplicationContext()和getApplication()返回的是Androidmanifest.xml中<application>标签对应的类的实例么?
它们有什么不同?
高洛峰2017-04-17 17:23:46
getApplicationContext()
返回的是应用的全局上下文,它随着应用的退出而销毁。getApplication()
返回的是应用application
Example.
PHPz2017-04-17 17:23:46
Somewhat similar to the difference between activity and context, one is the context of the application and the other is the instance of the application
阿神2017-04-17 17:23:46
getApplication() returns the instance of application,
getApplicationContext returns the application context.
The application context exists in the getApplication() instance