If you think the Android project SeniorDesign listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package fakesetgame.seniordesign.data;
//www.java2s.comimport android.database.Cursor;
import android.provider.BaseColumns;
/**
* A class to hold a game setting value retrieved from the database.
*/publicclass Setting {
privatefinallong _id;
privatefinal String name;
privatefinal String value;
private Setting(long _id, String name, String value) {
this._id = _id;
this.name = name;
this.value = value;
}
publiclong getId() {
return _id;
}
public String getName() {
return name;
}
public String getValue() {
return value;
}
publicstatic Setting fromCursor(Cursor c) {
returnnew Setting(
c.getLong(c.getColumnIndexOrThrow(TableDef._ID)),
c.getString(c.getColumnIndexOrThrow(TableDef.COLUMN_NAME_NAME)),
c.getString(c.getColumnIndexOrThrow(TableDef.COLUMN_NAME_VALUE))
);
}
/**
* Defines the found set table
*/publicstaticabstractclass TableDef implements BaseColumns {
publicstaticfinal String TABLE_NAME = "settings";
publicstaticfinal String COLUMN_NAME_NAME = "name";
publicstaticfinal String COLUMN_NAME_VALUE = "value";
publicstaticfinal String[] ALL_COLUMNS = {
TableDef._ID,
TableDef.COLUMN_NAME_NAME,
TableDef.COLUMN_NAME_VALUE,
};
}
}