I have a method that queries a database table via a provider and returns a CursorLoader
to be used to populate a UI via a CursorAdapter
.
I need in one particular case only to add some extra data that are not part of the database result set.
Is there a way to somehow for that case add some extra "fake" rows with the data?
Like creating a cursor loader from two data sources?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes. Use MatrixCursor to add some "fake" rows. Then merge the two cursors (CursorAdapter, MatrixCursor) using the MergeCursor class. MergeCursor will present the two Cursors as a single linear Cursor.