I know this question has been asked and also answered many times.
But sometimes some code works on specific paths and sometimes not. I wanted a universal code and universal way to convert content:// url to file path that can be applicable for every content://type
Because I don't want to waste developers time daily by asking convert content://xyz or content://abc etc.
You should forget from getting the file path. The assumption that there is a file behind the content url is wrong. The assumption that even if there is a file, you have the permission to access it is also wrong.
You are getting a "link" to a remote resource. It can come from a database, an online service, or any other source.
Oh ! So that's clearly mean universal way will not work in this scope.
Okay then suppose that content://xyz is an file path. How would you convert it then ?
I tried uri.localpath,uri.absolutepath, etc. It isnt 100% fine but it can give little match to what I want.
I guess com.android.externalstorage.documents points us that its path from external storage.
And also can you suggest me any file picker which can always return string file path Not content://xyz.
I got it that I can't get real file path. But can I read it ?
One maintainer of file picker says that we can't get real path from content path as you stated,
But he also says that using GetStream() method we can read that content.
Is that right ? Can we read it ?