List of usage examples for android.database.sqlite SQLiteCursor moveToNext
@Override public final boolean moveToNext()
From source file:com.chess.genesis.data.GameDataDB.java
public List<String> getOnlineGameIds() { final String username = getUsername(); final String[] data = { username, username }; final SQLiteCursor cursor = (SQLiteCursor) db .rawQuery("SELECT gameid FROM onlinegames WHERE white=? OR black=?", data); final List<String> list = new ArrayList<String>(cursor.getCount()); cursor.moveToFirst();//from ww w . j a va 2 s . c o m for (int i = 0, len = cursor.getCount(); i < len; i++) { list.add(cursor.getString(0)); cursor.moveToNext(); } cursor.close(); return list; }
From source file:com.chess.genesis.data.GameDataDB.java
public List<String> getArchiveGameIds() { final String username = getUsername(); final String[] data = { username, username }; final SQLiteCursor cursor = (SQLiteCursor) db .rawQuery("SELECT gameid FROM archivegames WHERE white=? OR black=?", data); final List<String> list = new ArrayList<String>(cursor.getCount()); cursor.moveToFirst();//from w ww. j a v a2 s. c om for (int i = 0, len = cursor.getCount(); i < len; i++) { list.add(cursor.getString(0)); cursor.moveToNext(); } cursor.close(); return list; }
From source file:com.chess.genesis.data.GameDataDB.java
public void recalcYourTurn() { final String username = getUsername(); final String[] data = { username, username }; final String query = "SELECT gameid, status, history, white, drawoffer FROM onlinegames WHERE white=? or black=?;"; final SQLiteCursor cursor = (SQLiteCursor) db.rawQuery(query, data); cursor.moveToFirst();//from w ww . ja va 2 s .c o m for (int i = 0, len = cursor.getCount(); i < len; i++) { final String gameid = cursor.getString(0); final int status = cursor.getInt(1); final String history = cursor.getString(2); final String white = cursor.getString(3); final int drawoffer = cursor.getInt(4); final GameInfo info = new GameInfo(context, status, history, white, drawoffer); final Object[] data2 = { info.getYourTurn(), gameid }; db.execSQL("UPDATE onlinegames SET yourturn=? WHERE gameid=?;", data2); cursor.moveToNext(); } cursor.close(); }