You can use static final
Something like this
Using java Syntax Highlighting
final public class MyShare{
static String myString;
MyApp(){
}
Parsed in 0.029 seconds, using
GeSHi 1.0.8.4
You can set value to it from anywhere with
MyShare.myString="something";
and read it like this
newVar=MyShare.myString;
It works..
There is one more way i found out
Using java Syntax Highlighting
import android.app.Application;
class MyApp extends Application {
private String myString;
public String getString(){
return myString;
}
public void setString(String s){
myString = s;
}
}
Parsed in 0.030 seconds, using
GeSHi 1.0.8.4
And you read and set it with functions:
Using java Syntax Highlighting
MyApp appState = ((MyApp)getApplicationContext());
appState.setString("testing");
Parsed in 0.033 seconds, using
GeSHi 1.0.8.4
But you need to set in manifest.xml-> application-->name to MyApp or what ever you name the class in order to work.