Custom AbstractCursor with json content
Is it possible to us开发者_C百科e the cursor class to expose a json object? I have a custom abstract cursor(param = json object) and find I can't override the abstract cursor moveToFirst/moveToNext to support iteration. Any pointers on how to keep the json format(no probs parsing the json) within the cursor without transforming it, would be great.
Thanks Alex
You can use MatrixCursor to return data that you have either in xml or json format.
MatrixCursor : A mutable cursor implementation backed by an array of Objects.
final MatrixCursor cursor = new MatrixCursor(SEARCH_COLUMN_NAMES);
for (OpenSearchHandler.Result result : results) {
cursor.addRow(new Object[] { result.id, result.title, result.description, result.url });
}
精彩评论