我有这个用于获取非媒体文件的查询,我想为光标获取正确的列,但我无法获取该列
Uri uri = MediaStore.Files.getContentUri("external");
String[] projection = null;
String selectionMimeType = MediaStore.Files.FileColumns.MIME_TYPE + "=?";
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension("pdf");
String[] selectionArgsPdf = new String[]{mimeType};
String sortOrder = MediaStore.Files.FileColumns.MIME_TYPE; // unordered
final Cursor allNonMediaFiles = managedQuery(uri, projection, selectionMimeType, selectionArgsPdf, sortOrder);
我正在使用此代码获取列并获取其中的所有数据,但它无法返回值
int file_column_index = allNonMediaFiles.getColumnIndex(MediaStore.Files.FileColumns._ID);
this.fileCount = allNonMediaFiles.getCount();
this.pdf = new String[this.fileCount];
this.pdfPath = new String[this.fileCount];
for (int i = 0; i < this.fileCount; i++) {
int pdfColumnIndex = allNonMediaFiles.getColumnIndex(MediaStore.Files.FileColumns.TITLE);
pdfPath[i] = allNonMediaFiles.getString(pdfColumnIndex);
}