Android编程中的上下文

Dav*_*own 6 android

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

任何人都可以告诉我关于android中使用的"上下文"术语.我想知道究竟是什么意思,因为这是我以前在很多地方看到的东西.

我发现它是一个类: - "关于应用程序环境的全局信息的接口",但我现在还不太清楚.

for Instance:public GetCurrentLocation(Context context){this.context = context; }

谢谢,大卫

Sam*_*gal 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
}

// ..

}
Run Code Online (Sandbox Code Playgroud)