试图在Android的解释方面给朋友 [英] Trying to explain context in Android to a friend

查看:82
本文介绍了试图在Android的解释方面给朋友的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图解释方面的朋友。作为写入文档中的上下文是,它是接口到系统资源(传感器,振子等),但将这个意思内存,CPU等?

和也,是上下文引用一个活动?我的意思是可以比较的一个方面等同于iOS的编程一个UIViewController和应用环境是应用程序的委托?我仍然在学习Android的,所以我可能不是最好的,使一个答案。如果任何一个可以提供一个全面的答案在此,我将非常感激。

问候不是以英语为母语,所以我也想知道意味着什么编程环境。

解决方案
  

我试图解释上下文一   朋友。写在上下文   文档是,它是接口   到系统资源(传感器,   振动等),但会这意味着   内存,CPU等?

没有,接口到内存和CPU的隐式Java语言的执行和内存模型提供的。

  

和也,是上下文   引用一个活动?

活动是一种上下文。你可以得到的班,从上下文继承一个完整列表在文档间接子类下的。

  

我的意思是   有可能比较,一个上下文   等于在iOS的一个UIViewController   编程和应用程序上下文   应用程序的委托?我仍在学习   Android的,所以我可能不是最好的   做出回答。如果任何一个可以提供   在此彻底的答案,我会   非常感谢。

我觉得两者有很大的不同。你可能会检查出任务和返回堆栈,了解更多活动为松散耦合,分开的单元。应用程序在你的应用程序子类可以类似于iOS中的应用程序委托。

  

问候不是以英语为母语   所以我也想知道是什么   背景意味着编程。

英语定义可能有帮助:

  

2的情况,即什么   发生了:该组的条件   存在何时何地发生什么事

在程序背景是相当接近这个定义。上下文经常告诉函数或对象的答案,这样的话:

  • 我在哪里?
  • 在哪里是资源X?
  • 是功能仅限Y?
  • 什么是我在做什么? (在C的情况下,尤其是常见的)

老实说,我认为你可以得到很远的Andr​​oid程序不理解上下文

I am trying to explain context to a friend. Context as written in the documentation is that it is interface to the system resources (sensors, vibrator etc) but would this mean memory, CPU etc?

And also, is context a reference to an activity? I mean is it possible to compare that a context is equal to a uiviewcontroller in iOS programming and application context is the app delegate? I am still learning Android so I might not be the best to make an answer. If any one can provide a thorough answer on this I would be very thankful.

Regards not a native English speaker so I would also like to know what context means in programming.

解决方案

I am trying to explain context to a friend. Context as written in the documentation is that it is interface to the system resources (sensors, vibrator etc) but would this mean memory, CPU etc?

No, "interface" to memory and CPU are implicitly provided by the execution and memory model of Java language.

And also, is context a reference to an activity?

Activities are a kind of context. You can get a full list of classes that inherit from Context in the docs under "Indirect Subclasses".

I mean is it possible to compare that a context is equal to a uiviewcontroller in iOS programming and application context is the app delegate? I am still learning Android so I might not be the best to make an answer. If any one can provide a thorough answer on this I would be very thankful.

I think the two are quite different. You might check out Tasks and the Back Stack to see more about Activities as loosely-coupled, separate units. A subclass of Application in your app may be similar to an app delegate in iOS.

Regards not a native English speaker so I would also like to know what context means in programming.

The English definition might help:

2 : the situation in which something happens : the group of conditions that exist where and when something happens

In programming "context" is quite close to this definition. The context often tells a function or object the answers to things like:

  • Where am I?
  • Where is resource X?
  • Is feature Y available?
  • What was I just doing? (especially common in the case of C)

Honestly, I think you can get very far in Android programming without understanding Context.

这篇关于试图在Android的解释方面给朋友的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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