android - getApplication() 和 getApplicationContext()返回的有什么不同?
PHPz
PHPz 2017-04-17 17:21:46
0
4
536

getApplicationContext()和getApplication()返回的是Androidmanifest.xml中<application>标签对应的类的实例么?
它们有什么不同?

PHPz
PHPz

学习是最好的投资!

reply all(4)
小葫芦

getApplicationContext()返回的是应用的全局上下文,它随着应用的退出而销毁。getApplication()返回的是应用applicationExample.

PHPzhong

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template