I am developing a VideoPlayer
. I convert the URI
of a launched intent to a string and it gives me content://media/external.....
. But I need to get the real path.
For example: /storage/extSdcard....
.
How do I do this?
Here is my code if needed:
videoURI = getIntent().getData();
vv.setVideoURI(videoURI);
videoName = videoURI.toString();
tvTitle.setText(videoName);
I found more elegance solution:
here i get uri from on onActivityResult()
1) In fragment you can use function like this way..
2) And activity you can use function like that.
Here is how to get real path of the file from Uri via MediaStore::
Use this code .This is working for all android version.This is tested code.This support all devices
Here's something I have used before:
you can use this code for selected vedio path.
you can refer the below link for your help.
Get filename and path from URI from mediastore
I hope you will success.