<分区>
Possible Duplicate:
What is Context in Android?
任何人都可以告诉我有关 android 中使用的“上下文”术语的信息。我想知道这到底是什么意思,因为这是我以前在很多地方看到的东西。
我发现它是一个类:-“关于应用程序环境的全局信息的接口(interface)”,但我现在还不太清楚。
例如: 公共(public) GetCurrentLocation(上下文上下文) { this.context = 上下文;
谢谢, 大卫
标签 android
<分区>
Possible Duplicate:
What is Context in Android?
任何人都可以告诉我有关 android 中使用的“上下文”术语的信息。我想知道这到底是什么意思,因为这是我以前在很多地方看到的东西。
我发现它是一个类:-“关于应用程序环境的全局信息的接口(interface)”,但我现在还不太清楚。
例如: 公共(public) GetCurrentLocation(上下文上下文) { this.context = 上下文;
谢谢, 大卫
最佳答案
我已经回答了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
}
// ..
}
关于android - Android 编程中的上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3635503/