本文整理汇总了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);
}
}