@Test public void shouldCreateWindowWithName() throws Exception { CursorWindow window = new CursorWindow("name"); assertThat(window.getName()).isEqualTo("name"); }
@Test public void shouldFillWindowWithCursor() throws Exception { CursorWindow window = new CursorWindow("name"); MatrixCursor testCursor = new MatrixCursor(new String[] { "a", "b", "c", "d"}); testCursor.addRow(new Object[] { 12, "hello", null, new byte[] {(byte) 0xba, (byte) 0xdc, (byte) 0xaf, (byte) 0xfe} }); testCursor.addRow(new Object[] { 34, "baz", 1.2, null }); testCursor.addRow(new Object[] { 46, "foo", 2.4, new byte[]{} }); DatabaseUtils.cursorFillWindow(testCursor, 0, window); assertThat(window.getNumRows()).isEqualTo(3); assertThat(window.getInt(0, 0)).isEqualTo(12); assertThat(window.getString(0, 1)).isEqualTo("hello"); assertThat(window.getString(0, 2)).isNull(); assertThat(window.getBlob(0, 3)).isEqualTo(new byte[] {(byte) 0xba, (byte) 0xdc, (byte) 0xaf, (byte) 0xfe}); assertThat(window.getInt(1, 0)).isEqualTo(34); assertThat(window.getString(1, 1)).isEqualTo("baz"); assertThat(window.getFloat(1, 2)).isEqualTo(1.2f); assertThat(window.getBlob(1, 3)).isEqualTo(null); assertThat(window.getBlob(2, 3)).isEqualTo(new byte[]{}); } }
private void awc_clearOrCreateWindow(String name){ CursorWindow win = getWindow(); if( win==null ){ win = new CursorWindow(name); setWindow(win); }else{ win.clear(); } } private void awc_closeWindow(){
CursorWindow window = new CursorWindow("collectDbStats"); try { executeForCursorWindow("PRAGMA database_list;", null, window, 0, 0, false, null);
CursorWindow window = new CursorWindow("MY_CURSOR_WINDOW"); cursor.fillWindow(0, window); intent.putExtra(String name, window);
private void awc_clearOrCreateWindow(String name){ CursorWindow win = getWindow(); if( win==null ){ win = new CursorWindow(name); setWindow(win); }else{ win.clear(); } } private void awc_closeWindow(){
Map<String, Object> row = builder.rows.get(rowIndex); if (current == null || !current.allocRow()) { current = new CursorWindow(false); current.setStartPosition(rowIndex); current.setNumColumns(builder.columns.length);
while (cursor.moveToNext()) { if (current == null || !current.allocRow()) { current = new CursorWindow(false); current.setStartPosition(rowIndex); current.setNumColumns(cursor.getColumnCount());
CursorWindow window = new CursorWindow("collectDbStats"); try { executeForCursorWindow("PRAGMA database_list;", null, window, 0, 0, false, null);