When to use CursorJoiner / MatrixCursor / MergeCursor?

前端 未结 2 866
鱼传尺愫
鱼传尺愫 2020-12-23 00:13

I\'m exploring different ways to get data elegantly from two or more joined tables.

I believe MergeCursor, (Android Developer Guide) seems to imply that

2条回答
  •  星月不相逢
    2020-12-23 00:29

    MergeCursor, as you indicate, is designed to concatenate two data sets "vertically", adding more rows.

    CursorJoiner is designed to concatenate two data sets "horizontally", adding more columns. You can think of this as akin to implementing a simple SQL JOIN.

    MatrixCursor allows you to build something that implements the Cursor interface out of pure data, that you pour into a two-dimensional data model.

    AbstractCursor allows you to wrap your own custom data set in a Cursor interface, overriding the methods that are necessary.

提交回复
热议问题