I'm having trouble getting file paths from uri returned by other activities.
I found many solutions on how to convert Uri to absolute file path like this one but its always dependent on type of content such as audio in the given link.
My app provides an activity to send files of any type.. that said I set the intent filter to
mimetype */*
but when I go in file browser and select a image file from from the camera photo folder I get path like /external/images/media/288 but If I pick a music file I get Uri like external/audio/media/1336
but on the other hand if I choose a non media file type (ex.pdf or zip) then I get the absoute path already in the Uri
So as you can see Its not known what path will Uri have it depends on what file i pick for sending with my app.
one possible solution is to make cursor queries for all types of media e.g audio video and image and if they return null then check for Uri.getPath() but I think thats a very bad practice or inefficient way !
Is there any way to get absolute Path from any Uri (given the file exists) without checking for each type of uri?