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
getApplication() returns the instance of application, getApplicationContext returns the application context. The application context exists in the getApplication() instance
getApplicationContext()
返回的是应用的全局上下文,它随着应用的退出而销毁。getApplication()
返回的是应用application
Example.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
It’s the same, but the place of use is different.
getApplication() returns the instance of application,
getApplicationContext returns the application context.
The application context exists in the getApplication() instance