本文整理匯總了Java中android.database.MergeCursor.moveToPosition方法的典型用法代碼示例。如果您正苦於以下問題:Java MergeCursor.moveToPosition方法的具體用法?Java MergeCursor.moveToPosition怎麽用?Java MergeCursor.moveToPosition使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.database.MergeCursor
的用法示例。
在下文中一共展示了MergeCursor.moveToPosition方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testIteratorWithMergeCursor
import android.database.MergeCursor; //導入方法依賴的package包/類
public void testIteratorWithMergeCursor() {
MatrixCursor cursor1 = new MatrixCursor(new String[]{"_id"});
cursor1.addRow(new Object[]{1L});
MatrixCursor cursor2 = new MatrixCursor(new String[]{"_id", "stringProperty"});
cursor2.addRow(new Object[]{2L, "Test"});
MergeCursor mergeCursor = new MergeCursor(new Cursor[]{cursor1, cursor2});
mergeCursor.moveToPosition(-1);
QueryResultIterable<TestEntity> iterable = new QueryResultIterable<TestEntity>(mergeCursor, mStore.getEntityConverter(TestEntity.class));
TestEntity te = iterable.get();
assertEquals(1L, te._id.longValue());
assertEquals(null, te.stringProperty);
mergeCursor.moveToPosition(1);
iterable = new QueryResultIterable<TestEntity>(mergeCursor, mStore.getEntityConverter(TestEntity.class));
te = iterable.get();
assertEquals(2L, te._id.longValue());
assertEquals("Test", te.stringProperty);
}
示例2: testMoveToPositionEmptyCursor
import android.database.MergeCursor; //導入方法依賴的package包/類
@Test
public void testMoveToPositionEmptyCursor() throws Exception {
Cursor[] cursors = new Cursor[2];
cursors[0] = null;
cursors[1] = null;
cursor = new MergeCursor( cursors );
assertThat(cursor.getCount()).isEqualTo(0);
assertThat(cursor.getColumnNames()).isNotNull();
cursor.moveToPosition(0);
assertThat(cursor.getColumnNames()).isNotNull();
}
示例3: testColumnNamesSingleCursor
import android.database.MergeCursor; //導入方法依賴的package包/類
@Test
public void testColumnNamesSingleCursor() throws Exception {
Cursor[] cursors = new Cursor[1];
cursors[0] = dbCursor1;
cursor = new MergeCursor( cursors );
for ( int i = 0; i < TABLE_1_INSERTS.length; i++ ) {
cursor.moveToPosition(i);
String[] columnNames = cursor.getColumnNames();
assertColumnNamesCursor1(columnNames);
}
}