class MyApp extends Application {
private String myState;
public String getState(){
return myState;
}
public void setState(String s){
myState = s;
}
}
class Blah extends Activity {
@Override
public void onCreate(Bundle b){
...
MyApp appState = ((MyApp)getApplicationContext());
String state = appState.getState();
...
}
}
Wednesday, August 29, 2012
How to declare global variable in android?
Labels:
android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment