I am using content chooser to get any file (MIME type */*). Then copying the file to a local file and storing the file in a database. Later I’m trying to open it in an external viewer. Using an intent, copying the file from the database to the content folder then opening it.
The problem seems to be that the file type is not known. Content chooser returns a URI but not details of the file type (e.g. a pdf file loses its .pdf at the end). If I manually add the correct file extension (eg .pdf or .jpg etc) it opens fine.
How can I find the filetype of a file selected with content chooser? I saw an earlier post with a function that gets the file name from a uri, but also the warning to not use it! And it didn’t work for my local files anyway..