我通过以下代码获取图像的uri:
Chose_Button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
//startActivityForResult(intent, 1);
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
startActivityForResult(intent, 1);
}
});
@Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
super.onActivityResult(requestCode, resultCode, data);
//path=data.getDataString();
image_uri=data.getData();
}
现在我想从uri获取图像的真实路径,我应该在Android 9. +中做什么?