I have two totally unrelated tables Notes and Tasks. I need to show both of them together in a combined list view. To achieve this, the combined cursor given to list adapter should have a FULL OUTER JOIN of the two tables. I am not sure which of CursorJoiner/MergeCursor is the way to go.Can someone give some working example of how to achieve this?
(Changing the content provider is not possible. So I have to work with cursors.)
EDIT: Also I need to be able to sort the items in a combined form. Notes has a subject column and Tasks has a title column. I want the combined cursor sorted alphabetically based on both of them.
As full outer or right outer join is not supported in sqlite and if you wana now about the CursorJoiner and CursorMerger go through these link below
When to use CursorJoiner / MatrixCursor / MergeCursor?
CursorJoiner
If you need data from two or more tables, the most straightforward thing to do is to use a SQL query that joins the two tables. However, sometimes you already have sources for two separate queries (such as a CursorLoader based on a ContentProvider), and you may wish to just re-use them, without creating a new query.This is where CursorJoiner comes in handy.
http://chariotsolutions.com/blog/post/android-advanced-cursors/
MergeCursor
MergeCursor allows you to present two or more cursors as a single cursor. You could get almost the same effect by doing a sql UNION query. However, MergeCursor allows you to have different columns in the various cursors, and still merge them.