Android startActivity(this,OtherActivity.class)如何使用上下文对象来启动活动?
我开始阅读上下文,我有点困惑 我找到了以下定义Android startActivity(this,OtherActivity.class)如何使用上下文对象来启动活动?,android,android-activity,android-context,Android,Android Activity,Android Context,我开始阅读上下文,我有点困惑 我找到了以下定义 The Context class is an “Interface to global information about an application environment.” 在这里我不明白什么是android应用程序环境 我们可以使用1。getAssets()2。获取资源()3。getPackageManager()4。getString()5。getSharedPrefsFile()方法,我们还可以启动活动,使用上下文广播意图 我认
The Context class is an “Interface to global information about an application environment.”
在这里我不明白什么是android应用程序环境
我们可以使用1。getAssets()2。获取资源()3。getPackageManager()4。getString()5。getSharedPrefsFile()方法,我们还可以启动活动,使用上下文广播意图
我认为,上述方法(粗体)向应用程序提供了应用程序的全局数据
这些资源称为应用程序全局数据吗
那么对于启动活动,Android使用了哪些全局信息
系统
视图如何使用上下文(它从上下文中获得什么信息)
我对上下文类的概念以及所有这些东西是如何关联的感到非常困惑
请提供任何帮助。请查看上下文详细信息。我认为这些东西可以帮助你理解语境的概念
View.getContext():
Returns the context the view is currently running in. Usually the currently active Activity.
Activity.getApplicationContext():
Returns the context for the entire application (the process all the Activities are running inside of). Use this instead of the current Activity context if you need a context tied to the lifecycle of the entire application, not just the current Activity.
ContextWrapper.getBaseContext():
If you need access to a Context from within another context, you use a ContextWrapper. The Context referred to from inside that ContextWrapper is accessed via getBaseContext().