Diffinitive rules for using Android's getBaseContext, getApplicationContext or using an Activity's “this”

前端 未结 1 1974
梦谈多话
梦谈多话 2020-12-02 10:06

I\'ve googled this question a lot and have found many differing recommendations on when to use getBaseContext, getApplicationContext or an

相关标签:
1条回答
  • 2020-12-02 10:32

    The getBaseContext() is the method of ContextWrapper. And ContextWrapper is, "Proxying implementation of Context that simply delegates all of its calls to another Context. Can be subclassed to modify behavior without changing the original Context." (as per javadocs)

    So this is used to delegate the calls to another context.

    0 讨论(0)
提交回复
热议问题