Last active
January 4, 2016 08:19
-
-
Save relict007/8595086 to your computer and use it in GitHub Desktop.
Merge 2 adapters in Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* source: https://stackoverflow.com/questions/6754973/how-to-insert-extra-elements-into-a-simplecursoradapter-or-cursor-for-a-spinner/14622789#14622789 | |
*/ | |
MatrixCursor extras = new MatrixCursor(new String[] { "_id", "title" }); | |
extras.addRow(new String[] { "-1", "New Template" }); | |
extras.addRow(new String[] { "-2", "Empty Template" }); | |
Cursor[] cursors = { extras, cursor }; | |
Cursor extendedCursor = new MergeCursor(cursors); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment