我不会使用存储访问框架在TextView中显示URI,但我得到的只是content://com.android.documents/。非常感谢您的帮助。
TextView filePath = findViewById(R.id.filepath);
if (requestCode == READ_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
Uri uri = null;
if (resultData != null) {
uri = resultData.getData();
Cursor cursor = getContentResolver().query(uri, null, null, null, null);
try {
if (cursor != null && cursor.moveToFirst()) {
String displayName = cursor.getString(cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME));
filePath.setText(uri.toString());
}
} finally {
cursor.close();
}
}
}