我正在尝试获取pdf文件的路径,但是stackoverflow中提供的所有解决方案均返回null。
String path;<br>
String[] proj = { MediaStore.Files.FileColumns.DATA };<br>
Cursor cursor = getContentResolver().query(uri, proj, null, null, null);<br>
if (cursor == null) {
path = uri.getPath();
} else {
cursor.moveToFirst();
int idx = cursor.getColumnIndex(MediaStore.Files.FileColumns.DATA);
path = cursor.getString(idx);
cursor.close();
}
filePath.setText(path);