here is my onActivityResult method -
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);
}
}
I am using the following github library -
https://github.com/zetbaitsu/Compressor
and when trying to create a new object out of it I get "file not found expection" when trying to create a new file from my java.net.Uri from onActivityResult, but the thing is that for sure there is a Uri at that place because I can fill an imageview from that path.
So, what am I missing?