Android编程中的上下文环境

10

可能重复:
什么是Android中的上下文?

请问有人可以告诉我在Android中使用的“context”术语吗?我想知道这究竟意味着什么,因为我在很多地方都看到了它。

我发现它是一个类:“关于应用程序环境的全局信息的接口”,但我仍然不太清楚。

例如: public GetCurrentLocation(Context context) { this.context = context; }

谢谢, 大卫

1个回答

3
我已经在这里回答了:这里 this.context = context 的表达不够清晰,另一种表达方式如下:
public class LocationClass {

private Context context_belonging_to_class = null;

// ..

public GetCurrentLocation(Context context_from_call_entity) {
  context_belonging_to_class = context_from_calling_entity; // initializing context variable
}

// ..

}

谢谢你的回答,它在一定程度上帮助我更好地理解了上下文类。 - David Brown

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接