这是我的onActivityResult方法-
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == PICK_VIDEO_REQUEST_CODE && resultCode == Activity.RESULT_OK) {
// upload cachedVideo
Uri originalDataUri = data.getData();
Timber.d("Receive image from: %s", originalDataUri);
File file = new File(originalDataUri.toString());
try {
//here is the line of the problem
File compressedFile = new Compressor(getContext()).compressToFile(file); // <--here I get "file not found expection"
cachedLocalImageUri = Uri.fromFile(compressedFile);
} catch (IOException e) {
e.printStackTrace();
}
mImageSent.setImageURI(cachedLocalImageUri);
}
}
我正在使用以下github库-
https://github.com/zetbaitsu/Compressor
,尝试从中创建新对象时,尝试从onActivityResult的java.net.Uri创建新文件时,出现“找不到文件期望”,但事实是肯定有一个Uri在那个地方,因为我可以从该路径填充图像视图。
那么,我想念什么?