标签:
private void populateTabs(int TabShown) {
// Get specific setup info from database into cursor
setupDBHelper = new DBAdapter(this);
setupDBHelper.open(DBAdapter.MAIN_DATABASE_NAME, DBAdapter.MAIN_DATABASE_VERSION);
setupCursor = setupDBHelper.fetchSetup(RowId);
this.startManagingCursor(setupCursor);
setupCursor.moveToFirst();
offsetDBHelper = new DBAdapter(this);
offsetDBHelper.open(DBAdapter.OFFSET_DATABASE_NAME, DBAdapter.OFFSET_DATABASE_VERSION);
offsetCursor = offsetDBHelper.fetchOffset(setupCursor.getString(setupCursor
.getColumnIndex(DBAdapter.SETUP_PART)));
this.startManagingCursor(offsetCursor);
offsetCursor.moveToFirst();
}
private void populateTabs(int TabShown) {
// Get specific setup info from database into cursor
setupDBHelper = new DBAdapter(this);
setupDBHelper.open(DBAdapter.MAIN_DATABASE_NAME, DBAdapter.MAIN_DATABASE_VERSION);
offsetDBHelper = new DBAdapter(this);
offsetDBHelper.open(DBAdapter.OFFSET_DATABASE_NAME, DBAdapter.OFFSET_DATABASE_VERSION);
setupCursor = setupDBHelper.fetchSetup(RowId);
this.startManagingCursor(setupCursor);
setupCursor.moveToFirst();
offsetCursor = offsetDBHelper.fetchOffset(setupCursor.getString(setupCursor
.getColumnIndex(DBAdapter.SETUP_PART)));
this.startManagingCursor(offsetCursor);
offsetCursor.moveToFirst();
}
public class DBAdapter {
// DB info
public static final String MAIN_DATABASE_NAME = "Bowers";
public static final String OFFSET_DATABASE_NAME = "BowersOffset";
public static final String NOTES_DATABASE_NAME = "Notes";
public static final String GMCODES_DATABASE_NAME = "GMCodes";
public static final int MAIN_DATABASE_VERSION = 1;
public static final int OFFSET_DATABASE_VERSION = 1;
public static final int NOTES_DATABASE_VERSION = 1;
public static final int GMCODES_DATABASE_VERSION = 1;
public static String MAIN_DB_PATH = "/data/data/cdc.workshopapps.BowersMfgHelper/databases/";
// database control
private DatabaseHelper mDbHelper;
private static SQLiteDatabase mDb;
private static Context mCtx;
private static class DatabaseHelper extends SQLiteOpenHelper {
DatabaseHelper(Context context, String dbname, int dbversion) {
super(context, dbname, null, dbversion);
if (checkDataBase(dbname)) {
openDataBase(dbname);
} else {
try {
this.getReadableDatabase();
copyDataBase(dbname);
this.close();
openDataBase(dbname);
} catch (IOException e) {
throw new