Difference between getContext() , getApplicationCo

2018-12-31 05:49发布

What is the difference between getContext() , getApplicationContext() , getBaseContext() , and "this"?

Though this is simple question I am unable to understand the basic difference between them. Please give some easy examples if possible.

8条回答
其实,你不懂
2楼-- · 2018-12-31 06:18

Context provides information about the Actvity or Application to newly created components.

Relevant Context should be provided to newly created components (whether application context or activity context)

Since Activity is a subclass of Context, one can use this to get that activity's context

查看更多
看淡一切
3楼-- · 2018-12-31 06:18

A piece of UML diagram of Context

enter image description here

查看更多
登录 后发表回答