
Application – is a singleton instance running in your application
process. It can be accessed via methods like getApplication() from an
Activity or Service,and getApplicationContext() from any other object
that inherits from Context. Regardless of where or how it is
accessed,you will always receive the same instance from within your
process.Activity/Service – inherit from Contextwrapper which implements the
same API,but proxIEs all of its method calls to a hIDden internal
Context instance,also kNown as its base context. Whenever the
framework creates a new Activity or Service instance,it also creates
a new ContextImpl instance to do all of the heavy lifting that either
component will wrap. Each Activity or Service,and their
corresponding base context,are unique per-instance.
这篇文章真的有助于清除它:https://possiblemobile.com/2013/06/context/
总结以上是内存溢出为你收集整理的Android Activity / Application / Service的上下文是否属于同一个应用程序?全部内容,希望文章能够帮你解决Android Activity / Application / Service的上下文是否属于同一个应用程序?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)