getApplicationContext(),getBaseContext(),getApplication(),的getParent() [英] getApplicationContext(), getBaseContext(), getApplication(), getParent()

查看:111
本文介绍了getApplicationContext(),getBaseContext(),getApplication(),的getParent()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

之间的区别是什么:

  1. getApplicationContext()
  2. getBasecontext()
  3. getApplication()
  4. 的getParent()
  1. getApplicationContext()
  2. getBasecontext()
  3. getApplication()
  4. 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆