分类: SQLite/嵌入式数据库
2011-10-09 16:34:43
public DBAdapter db;
GameScene scene;
public void onCreate() {
…
db=new DBAdapter(this);
}
public void onLoadComplete() {
Textures.load();
scene = new GameScene();
setScene(scene);
Log.i("Rokon", "read bob3");
if(true) {
db.open();
Cursor c = db.getAllTitles();
if(c!=null && c.moveToFirst())
{
do{printDbg(c);}
while(c.moveToNext());
}
c = db.getTitle(1);
scene.setXXYY(c.getFloat(2), c.getFloat(3));
db.close();
}
}
@Override
public void onPause() {
saveData();
super.onPause();
}
public void saveData() {
db.open();
db.updateTitle(1, "bob", scene.bob3.x, scene.bob3.y);
Log.i("Rokon", "save bob3");
db.close();
}