Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static synchronized GlobalClass getInstance()
- {
- if(instance==null)
- {
- instance=new GlobalClass();
- }
- return instance;
- }
- /**
- * @return This session's config data.
- */
- public Config getConfig() {
- Config config = new Gson().fromJson(mPreferences.getString(KEY_CONFIG, null), Config.class);
- return config;
- }
- /**
- * Save this session's config data.
- *
- * @param config
- * Config data.
- */
- public void setConfig(Config config) {
- mPreferences.edit().putString(KEY_CONFIG, new Gson().toJson(config)).commit();
- }
- /**
- * @return Application configuration parameters.
- */
- public static Config getConfig() {
- if (sConfig == null)
- sConfig = sPreferences.getConfig();
- return sConfig;
- }
- /**
- * Set application configuration parameters.
- *
- * @param config
- * Config to set.
- */
- public static void setConfig(Config config) {
- sPreferences.setConfig(config);
- sConfig = config;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement