Back to project page field-data-app.
The source code is released under:
MIT License
If you think the Android project field-data-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package nz.cri.gns.springs.db; /*w ww. ja va 2 s. co m*/ import com.j256.ormlite.field.DatabaseField; import com.j256.ormlite.table.DatabaseTable; /** * Configuration entries are key/value pairs used for application settings. * @author duncanw */ @DatabaseTable public class Configuration { @DatabaseField(canBeNull = false, id = true) private String key; @DatabaseField private String value; public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public static void setConfiguration(String key, String value, SpringsDbHelper helper) { Configuration config = helper.getConfigurationDao().queryForId(key); if (config == null) { config = new Configuration(); config.setKey(key); config.setValue(value); helper.getConfigurationDao().create(config); } else { config.setValue(value); helper.getConfigurationDao().update(config); } } public static String getConfiguration(String key, SpringsDbHelper helper) { Configuration config = helper.getConfigurationDao().queryForId(key); if (config == null) { return null; } return config.getValue(); } }