onActivityResult的intent.getPath()没有给出正确的文件名
final Intent chooseFileIntent = new Intent(Intent.ACTION_GET_CONTENT); String[] mimetypes = {"application/pdf"}; chooseFileIntent.setType("*/*"); chooseFileIntent.addCategory(Intent.CATEGORY_OPENABLE); if (chooseFileIntent.resolveActivity(activity .getApplicationContext().getPackageManager()) != null) { chooseFileIntent.putExtra(Intent.EXTRA_MIME_TYPES, mimetypes); activity.startActivityForResult(chooseFileIntent, Uploader.PDF); }
onActivityResult
:
@Overrideprotected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data);}
data.getData().getPath()
/Document/acc=1;doc=28
暮色呼如
慕田峪9158850