活动与上下文之间的区别是什么? [英] What is the difference between Activity and Context?
本文介绍了活动与上下文之间的区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有活性和语境一样,还是有区别?
Are Activity and Context the same, or are there differences?
当我应该有一种方法传递一个活动,当一个上下文?
When should I have a method pass an Activity, and when a Context?
推荐答案
据我了解: 语境是基本对象。所以每活动相同的应用程序从上下文派生。这意味着,每一个活动,每一个应用程序是一个上下文;
As far as I understand: Context is the Base Object. So every Activity same as Application derives from Context. This means that every Activity and every Application IS a Context;
从<一个href="http://developer.android.com/reference/android/app/Activity.html#jd-content">developer.android.com
java.lang.Object
↳ android.content.Context
↳ android.content.ContextWrapper
↳ android.view.ContextThemeWrapper
↳ android.app.Activity
和应用程序
java.lang.Object
↳ android.content.Context
↳ android.content.ContextWrapper
↳ android.app.Application
这篇关于活动与上下文之间的区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文