use of android.database.MatrixCursor in project Android-Developers-Samples by johnjohndoe.
the class MyCloudProvider method queryDocument.
// END_INCLUDE(open_document_thumbnail)
// BEGIN_INCLUDE(query_document)
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
Log.v(TAG, "queryDocument");
// Create a cursor with the requested projection, or the default projection.
final MatrixCursor result = new MatrixCursor(resolveDocumentProjection(projection));
includeFile(result, documentId, null);
return result;
}
use of android.database.MatrixCursor in project Timber by naman14.
the class MusicService method updateCursorForDownloadedFile.
private void updateCursorForDownloadedFile(Context context, Uri uri) {
synchronized (this) {
closeCursor();
MatrixCursor cursor = new MatrixCursor(PROJECTION_MATRIX);
String title = getValueForDownloadedFile(this, uri, "title");
cursor.addRow(new Object[] { null, null, null, title, null, null, null, null });
mCursor = cursor;
mCursor.moveToFirst();
}
}
use of android.database.MatrixCursor in project Etar-Calendar by Etar-Group.
the class Utils method matrixCursorFromCursor.
public static MatrixCursor matrixCursorFromCursor(Cursor cursor) {
if (cursor == null) {
return null;
}
String[] columnNames = cursor.getColumnNames();
if (columnNames == null) {
columnNames = new String[] {};
}
MatrixCursor newCursor = new MatrixCursor(columnNames);
int numColumns = cursor.getColumnCount();
String[] data = new String[numColumns];
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
for (int i = 0; i < numColumns; i++) {
data[i] = cursor.getString(i);
}
newCursor.addRow(data);
}
return newCursor;
}
use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.
the class StressProvider method queryDocument.
@Override
public Cursor queryDocument(String documentId, String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(DEFAULT_DOCUMENT_PROJECTION);
final StubDocument document = mDocuments.get(documentId);
includeDocument(result, document);
return result;
}
use of android.database.MatrixCursor in project android_frameworks_base by ResurrectionRemix.
the class StubProvider method queryRoots.
@Override
public Cursor queryRoots(String[] projection) throws FileNotFoundException {
final MatrixCursor result = new MatrixCursor(projection != null ? projection : DEFAULT_ROOT_PROJECTION);
for (Map.Entry<String, RootInfo> entry : mRoots.entrySet()) {
final String id = entry.getKey();
final RootInfo info = entry.getValue();
final RowBuilder row = result.newRow();
row.add(Root.COLUMN_ROOT_ID, id);
row.add(Root.COLUMN_FLAGS, info.flags);
row.add(Root.COLUMN_TITLE, id);
row.add(Root.COLUMN_DOCUMENT_ID, info.document.documentId);
row.add(Root.COLUMN_AVAILABLE_BYTES, info.getRemainingCapacity());
}
return result;
}
Aggregations