【发布时间】:2011-04-07 19:44:33
【问题描述】:
谁能告诉我android中使用的“上下文”术语。我想知道这到底意味着什么,因为这是我以前在很多地方看到的东西。
我发现它是一个类:-“关于应用程序环境的全局信息的接口”,但我现在还不太清楚。
例如: 公共GetCurrentLocation(上下文上下文) { this.context = 上下文; }
谢谢, 大卫
【问题讨论】:
标签: android
谁能告诉我android中使用的“上下文”术语。我想知道这到底意味着什么,因为这是我以前在很多地方看到的东西。
我发现它是一个类:-“关于应用程序环境的全局信息的接口”,但我现在还不太清楚。
例如: 公共GetCurrentLocation(上下文上下文) { this.context = 上下文; }
谢谢, 大卫
【问题讨论】:
标签: android
我已经回答了here
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
}
// ..
}
【讨论】: