我想在java类中访问自定义的对象,这个java类中包括ApplicationContext 对象。
我创建了一个自定义的应用程序类:
class A extends android.app.Application{
public String abc = "xyz";
}
一个简单的java类:
class B {
private appContext;
// This constructor is called from activity.
B(Context ctx){
this.appContext = ctx;
}
private void foo(){
// want to access Class A's abc String vairable Here...HOW TO DO THAT?????
}
}
如何访问 foo 方法中类 A 中的 abc 字符串变量?