如何访问变量内容
public class Global extends Application {
String gotUsername;
String gotPassword;
String gotIPAddress;
void onStartCommand(Intent intent){
Bundle gotAuthen = intent.getExtras();
gotUsername = gotAuthen.getString("key1");
gotPassword = gotAuthen.getString("key2");
gotIPAddress = gotAuthen.getString("key3");
}
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate();
}
}
像这样的公共课?
Public Class MyApp {
}
我试过了
Global Username = (Global) getApplicationContext();
但我发现getApplicationContext();
仅用于活动。
那我该怎么做呢?
谢谢你的帮助!