我正在尝试从Android SD卡中选择一个像这样的PDF
Intent intent = new Intent();
intent.setType("application/pdf");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Choose Documents"), DOCUMENT_SELECT_PDF);
此代码返回所选PDF文件的URI,如下所示
URI值
content://com.google.android.apps.docs.storage/document/acc%3D1%3Bdoc%3D420
你们可以帮忙吗,我怎么能从这个URI中获得实际路径??????????
其余代码在这里
case DOCUMENT_SELECT_PDF:
if (resultCode == RESULT_OK) {
try {
final Uri pdfUri = imageReturnedIntent.getData();
documentFilePath = DocumentHelper.getPDFPath(this, pdfUri);
if (documentFilePath != null) {
documentName = DocumentHelper.getFileName(documentFilePath);
documentMimeType = DocumentHelper.getMimeType(this, pdfUri);
uploadDocuments();
}
} catch (Exception e) {
e.printStackTrace();
}
}
break;