public void saveSetting() { // setting된 값을 db에 업테이트 합니다. db.open(false); for (int i = 0; i < al.size(); i++) { if (buffer[i] != al.get(i).isChecked()) { // 초기 boolean값과 설정된 boolean 값이 다를 때 db.write( "UPDATE classlist SET askable = " + Booleantoint(al.get(i).isChecked()) + " WHERE classname = '" + al.get(i).getName() + "'"); // db update } // UPDATE classlist SET usable = 0 WHERE classname = 'al.get(i).getName()' } db.close(); }
private void readDatabass() { db.open(true); Cursor c = db.read("SELECT * FROM classlist WHERE classname = '" + packageName + "'"); if (c.getCount() == 0) { db.close(); db.open(false); db.write("INSERT INTO classlist values(null, '" + packageName + "', 1, 1)"); db.close(); db.open(true); c = db.read("SELECT * FROM classlist WHERE classname = '" + packageName + "'"); } askable = Inttoboolean(c.getInt(3)); usable = Inttoboolean(c.getInt(2)); db.close(); c.close(); }