<application android:label="@string/app_name" android:icon="@drawable/logo" android:name="com.homesystem.net.CustomApplication"> </application>
CustomApplication class is a class which used to store and access global variables.
public class CustomApplication extends Application {
public static String message = "";
public static boolean state =true;
private static CustomApplication singleton;
public static CustomApplication getInstance() {
return singleton;
}
@Override
public void onCreate() {
super.onCreate();
singleton = this;
}
}
And then inside any activity you can update and real values in CustomApplication class.
String Message = CustomApplication .message;
boolean state=CustomApplication .state;
No comments:
Post a Comment