Sam YC
Sam YC

Reputation: 11617

ContentProvider with file rather than database

I have seen quite a lot of example that using ContentProvider to interface with the sqlite database. I read the documentation somewhere that say ContentProvider is able to interact with normal file as well. But how are we going to do that? So far, I can't find any simple example related to this, I tried to write my own but found that

public abstract Cursor query (Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)

return Cursor but not file input/output stream (or other equivalent.) for me to retrieve the data from file.

Any idea how to do that?

Upvotes: 0

Views: 87

Answers (1)

Durairaj Packirisamy
Durairaj Packirisamy

Reputation: 4725

when you are implementing a contentprovider in your application, it is up to you how to handle the query function. In the qwery function, instead of returning a cursor from a database query, you can construct a MatrixCursor, and fill the entries and return it.

Upvotes: 1

Related Questions