getApplicationContext(),getBaseContext(),getApplication(),的getParent() [英] getApplicationContext(), getBaseContext(), getApplication(), getParent()
本文介绍了getApplicationContext(),getBaseContext(),getApplication(),的getParent()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
之间的区别是什么:
-
getApplicationContext()
-
getBasecontext()
-
getApplication()
-
的getParent()
getApplicationContext()
getBasecontext()
getApplication()
getParent()
您能否解释一下一个简单的例子?
Can you elaborate with one simple example?
推荐答案
getApplicationContext()
应用程序上下文与应用程序了相关的而且将永远是整个生命周期相同
getApplicationContext()
Application context is associated with the Applicaiton and will always be the same throughout the life cycle
getBasecontext()
不应使用其与所述活动相关联,并且当活动被破坏可能可能被破坏JST使用背景信息,而不是它
getBasecontext()
should not be used jst use Context instead of it which is associated with the activity and could possible be destroyed when the activity is destroyed
这篇关于getApplicationContext(),getBaseContext(),getApplication(),的getParent()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文