3

I have some data in JSON format that I'd like to convert into a cursor so it can be returned by a content provider. What's the best way to go about this?

I considered using a MatrixCursor but my content provider needs to return type Cursor, not MatrixCursor.

Any suggestions would be much appreciated!

Thanks.

1 Answers1

2

MatrixCursor extends AbstractCursor, AbstractCursor implements CrossProcessCursor, and CrossProcessCursor implements Cursor. So you can use MatrixCursor in your content provider.

But note that even you can put a byte[] array into MatrixCursor, however Cursor.getBlob() returns wrong value in older APIs. There was an issue (it was fixed). I couldn't remember or find the link to the issue but you can easily test it on emulators :-) Or here is a related question: Passing binary blob through a content provider.

Community
  • 1
  • 1