Difference between getContext() , getApplicationContext() , getBaseContext() and “this”

前端 未结 8 1893
臣服心动
臣服心动 2020-11-22 02:15

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

Though

8条回答
  •  醉话见心
    2020-11-22 02:35

    getApplicationContext() - Returns the context for all activities running in application.

    getBaseContext() - If you want to access Context from another context within application you can access.

    getContext() - Returns the context view only current running activity.

提交回复
热议问题